how to connect to database using dsn and udl

Good day. 

I want to connect to an SQL db using . I Tried it using oledb, but it doesn't work.
--
dim con as new oledb.oledbconnection()
dim com as new oledb.oledbcommand()
con.connectionstring = "dsn=exer4;uid=sa;password"
com.connection = con
con.open
con.close
--
Also, how to connect to db using udl? I created a udl file that connects to an sql db, located in the folder with the aspx pages. In vb.net, I use application.startuppath to locate the udl file, however in asp.net application.startuppath points to another location other than the page directory?
--
dim con as new oledb.oledbconnection()
dim com as new oledb.oledbcommand()
con.connectionstring = "File Name =' & system.windows.forms.application.startuppath.tostring & "\test.udl"
com.connection = con
con.open
con.close
--
Any advice would be greatly appreciated. Thanx.
0
quietfulness
5/25/2004 5:33:16 AM
asp.net.object-datasource 16182 articles. 0 followers. Follow

1 Replies
699 Views

Similar Articles

[PageSpeed] 39

Find out everything you need to know about connection strings here:

http://www.connectionstrings.com/
As for UDL files, it's better to use a connection string in the web.config or registry.
Darrell Norton, MVP
Darrell Norton's Blog


Please mark this post as answered if it helped you!
0
DarrellNorton
5/25/2004 2:28:47 PM
Reply:

Similar Artilces:

can't connect to sql server database with same connection used in visual studio .net 2003
I have the following code that works fine in visual studio .net 2003 but not with VWD.  I have sql server 2000 developer edition installed locally and this connection works fine with visual studio.  With VWD it fails with the exception "System.Data.SqlClient.SqlException: Login failed for user 'DARRELL\ASPNET'".  It fails on the conn.Open line.   any ideas on what the issue is?Dim conn As SqlConnectionDim connstr As Stringconnstr = "Data Source=DARRELL;Initial Catalog=Event;Integrated Security=SSPI;"Dim daEvents As New SqlDataAdapter("select * from events", connstr...

Can I use DSN less to connect database
Hi, Can I use DSN less to connect database, like connect to *.mdb? from LEO ...

using oledb with ado.net connection to a database
I have just started using visual studio.net and am trying to do a database example Below is my code Public Class fclsMain Inherits System.Windows.Forms.Form Private m_cnADONetConnection As New OleDb.OleDbConnection Private m_daDataAdapter As New OleDb.OleDbDataAdapter Private m_cbCommandBuilder As OleDb.OleDbCommandBuilder Private m_dtContacts As New DataTable Private m_rowPosition As Integer = 0 #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by th...

how to connect local access database using dsn
how to connect local access database using dsn Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=; See www.connectionstrings.com for more examples! If this post was useful to you, please mark it as answer. Thank you!...

Database Connection and Data Manipulation using VB.NET
Hiya all,I am currently having a problem whereby I want to populate my meta tags and page title with information from the database. I figured that the best way of doing this would be to setup a database connection using VB.NET then somehow putting that information into the relevant <title> and <meta> tags. The three records I want to populate are: title, meta keywords and meta description. I am quite new to this so if anyone can point me in the right direction it would be much appreciated!!Thanks in advance!!  Well this is an original idea You can do one thing , create a...

Any examples about using Object Database with ADO.NET(c#)
Can I have any examples source codes about using Object Database with ADO.NET(c#) Is this a particular db or Object DB vs Relation DB? If the latter here is one link I found <a href = "http://www.informit.com/content/index.asp?product_id=%7BA2B9405F-6B83-4474-B034-BC613B68EB1B%7D">http://www.informit.com/content/index.asp?product_id=%7BA2B9405F-6B83-4474-B034-BC613B68EB1B%7D</a>. You might want to also check the threads on the Architecture forum on O/R mappers like Entity Broker, Norpheme etc. HTHEric LandesMADNUG President http://www.madnug.netCrystal Alliance Edit...

How to create a single Oracle Database connection method or function to be used on or by all classes and pages that want to connect to the database?
 How to create a single Oracle Database connection method or function  to be used on or by all classes and pages that want to connect to the database? How can I create one method or function in csharp to be used on all pages or classes when conenction to the database? Please give an example.I have database connections which I am using on each and very page or classes, but I can I put in one page then I just start  calling it?Database connection I am using:   OracleConnection dbconnection;    this.dbconnection = new System.Data.OracleClient.OracleConnec...

Timeout connecting with .NET connection object
I have a SQL Anywhere 9 database that I can connect to fine via Sybase Central or ISQL. However, when I attempt to connect using the AsaConnection object from the IAnywhere.Data.AsaClient namespace, the open connection call times out. The code works fine on my development box, but I cannot get the connection to work on the production box. Any ideas? Thanks, David ...

Connecting to Progress Database using ADO.NET and reading Blob
I'm trying to connect to a Progress Database using ADO.Net and have 2 questions.   The first question is:  How can I connect to the database using the ADO.NET OleDB objects.   This is the connection string that I'm using and I get an error, Please Note:  I can successfully connect using a DSN Connection string. "Provider=SQLOLEDB;DRIVER=DataDirect 4.20 32-BIT OpenEdge SQL v10.0B;HOST=192.168.55.99;PORT=7150;DB=nxt;UID=XXXXX;PWD=XXXXX" .  Using this connection string, I get an Invalid Connection string Attribute" error.&nb...

database connection problem using C# .net 2.0
 Hi,I am learning C# .net 2.0. I use below code to connect database. But, it gave me an error message as below. Please help me. string strConn = WebConfigurationManager.ConnectionStrings["SqlConnectionstring"].ConnectionString;  SqlConnection objConnect = new SqlConnection(strConn);-----------------------------------------------------Server Error in '/DOTNET2005' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your...

problem with Connecting to a SQL Anywhere Studio Database Using ADO.NET
I am trying to connect and read the data from the asademo.db database that is used in the document "Connecting to a SQL Anywhere Studio Database Using ADO.NET ". I am using Sql Anywhere v7.0 and MS Visual Studio .Net 2003 with C#. I can connect to the database but I get a 'Specific cas is not valid' exception when I try to run the myReader = myCommand.ExecuteReader() line in the demo course. Can anyone tell me why it is not working? I'm getting the same error using V7.0.2.1402. Did you find any solution/workaround? You need a more recent version of the A...

Can't connect to MySQL database using ODBC.NET
I recently downloaded and installed ODBC.NET from Microsoft Download Center site. I can reference the namespace (Microsoft.Data.Odbc) in my project and the code (C#) compiles just fine. However, at runtime, I cannot connect to the database. It keeps complaining about not being able to find the data source. The connection string is: "Driver={MySQL};SERVER=...;DATABASE=...;UID=...;PASSWORD=...;PORT=3306;OPTION=3;STMT=;" If I use MySQL ODBC driver, I have no problem whatsoever. The connection string is almost the same, only Driver={MySQL} is replaced by Driver={MySQL ODBC 3.5...

How can I share connection object from Master page using vb.net?
Hi, I am using VB.NET for my Web project and I was wondering if there is a way to share database connection object under a master page and access it from any page using Master page as a template. Thanks,Marius Hi, Even if there would be, it's not a good idea to try to preoptimize since it can distract connection pooling. It's better just use the connection locally (so it gets closed under every possible circumstance), open it as late a spossible and close as early as possible. Another thing is that if master page is  used on multiple pages, it still is always separate i...

connect to MS SQL database using visual studio.net failed
Hi, I'm trying to connect to MS SQL 2000 using visual studio.net in window server 2003. Clicking the server explorer, connect to database icon, and selecting the provider and so on, when i click on the 'test connection', an error appear indicating : "Test connection failed because of an error in initializing provider. Device activation error. The physical name : c:\MCSDWebapps\Chapter05\vbADOsnippers\Contact.MDF may be incorrect " Note : I'm connecting to window server 2003 locally i.e I'm working on the same computer i.e server 2003. I've tried in win XP Pro and it wor...

Web resources about - how to connect to database using dsn and udl - asp.net.object-datasource

Database - Wikipedia, the free encyclopedia
... requiring information. For example, modelling the availability of rooms in hotels in a way that supports finding a hotel with vacancies. Database ...

Database - Wikipedia, the free encyclopedia
A database is an organized collection of data . The data are typically organized to model aspects of reality in a way that supports processes ...

Ben Carson calls for database of all foreigners in US
Boston Herald Ben Carson calls for database of all foreigners in US Boston Herald Republican presidential candidate, Dr, Ben Carson, center, ...

GOP rivals condemn Donald Trump for backing Muslim database
COLUMBIA, S.C. (AP) — Retired neurosurgeon Ben Carson said Saturday that he wants to expand the government's surveillance operations aimed at ...

Donald Trump wants "surveillance of certain mosques," database of refugees - Videos - CBS News
... rally in Birmingham, Alabama, Republican presidential candidate Donald Trump called for increased scrutiny over mosques, along with a database ...

Trump Wants A Database For All Syrian Refugees Who Enter America
Trump Wants A Database For All Syrian Refugees Who Enter America

US Republican rivals blast Donald Trump for Muslim database comments
US Republican rivals blast Donald Trump for Muslim database comments - Donald Trump said he would implement a database to keep track of Muslims ...

WATCH 'TROJAN HORSE' Trump wants database for Syrian refugees in US
WATCH 'TROJAN HORSE' Trump wants database for Syrian refugees in US

Presidential Candidates Condemn Donald Trump's 'Database' Comment
... and Democratic presidential candidates have condemned Donald Trump for his recent statements suggesting the United States should start a database ...

Donald Trump is Under Media Assault for Suggesting ‘Muslim Database,’ But Here’s What He Says About It ...
"Donald Trump's plan for a Muslim database draws comparison to Nazi Germany"...

Resources last updated: 11/23/2015 3:09:13 PM