|
-
Jan 17th, 2007, 02:10 AM
#1
Thread Starter
Junior Member
connection to database
i use visual web developer n microsoft sql server for database,so my source code for connection to database
Dim sqlConn As SqlConnection = New SqlConnection()
sqlConn.ConnectionString = "Data Source=NORA;Initial Catalog=myAccount;User Id=sa;Password=password;"
sqlConn.Open()
my questions is:
everytime i want access data from database, i need to write this source code,, so if have 10 page that need acces to database, i have to write the same source code, if i need to change the location of server, i need to modify the source code in all pages,
so i hope anybody can give me solution where i do need to write repeatly the same code, my plan is want to write the source code for connection in some file or some place, and invoke or call them as many times as my application needs..
please help me now
-
Jan 17th, 2007, 02:25 AM
#2
Re: connection to database
Store the connection string in your config file and have every connection retrieve it from there.
-
Jan 17th, 2007, 03:39 AM
#3
Thread Starter
Junior Member
Re: connection to database
how to retrieve it, can u write the code to retrieve it...
-
Jan 17th, 2007, 04:15 AM
#4
Thread Starter
Junior Member
Re: connection to database
how to retrieve it, can u write the code for me to retrieve it, example coding to do it..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|