Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 118,658 VB.NET Programmers for FREE! Ask your question and get quick answers from experts. There are 887 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



VB.2005 connection string

 
Reply to this topicStart new topic

VB.2005 connection string

joe.lim
post 15 Jun, 2008 - 08:47 PM
Post #1


New D.I.C Head

*
Joined: 9 Jun, 2008
Posts: 8

Hi everyone.

I really need some help here. The problem is, I have vb.net2005 application and a sqlexpress2005 database. But everytime I make changes to the database, be it changes in table structure, editng data or whatever in the vs.net IDE. The next time I try to run the application, the connection to the database will fail unless I edit my connection string, as example below:
now Database=dbname8, if I edited the database in VS IDE, I'll have to change the Database=dbname9 or something else and not dbname8. The same thing happen when I try to connect from a VB6 application. I've google the net and so far I have no idea what is going on.
Really appreciate your help.
CODE

strConnect = "Provider=SQLNCLI;Server=.\SQLExpress;AttachDbFilename=" & initPath & ";Database=dbname8;Trusted_Connection=Yes;Connect_Timeout=0"
MyConn.ConnectionString = strConnect
User is offlineProfile CardPM

Go to the top of the page


motcom
post 16 Jun, 2008 - 06:49 AM
Post #2


New D.I.C Head

*
Joined: 16 Jun, 2008
Posts: 7

I normally do not use a db file name. I use a connection string in my system settings and its something like this "Data Source=YourServerName;Initial Catalog=YourDataBaseName;Persist Security Info=True;User ID=YourUserName;Password=YourPassoword"
User is offlineProfile CardPM

Go to the top of the page

joe.lim
post 17 Jun, 2008 - 12:40 AM
Post #3


New D.I.C Head

*
Joined: 9 Jun, 2008
Posts: 8

QUOTE(motcom @ 16 Jun, 2008 - 06:49 AM) *

I normally do not use a db file name. I use a connection string in my system settings and its something like this "Data Source=YourServerName;Initial Catalog=YourDataBaseName;Persist Security Info=True;User ID=YourUserName;Password=YourPassoword"


Thanks motcom. I'll try your solutions.
User is offlineProfile CardPM

Go to the top of the page

joe.lim
post 27 Jun, 2008 - 01:43 AM
Post #4


New D.I.C Head

*
Joined: 9 Jun, 2008
Posts: 8

Hi again motcom,

I am still having the same problem. Meaning that sometime the connection to the database work but once I make changes to it or copy the whole application from one PC to another, the connection fail, most of the time anyway, but sometime it does connect without problem.
QUOTE(motcom @ 16 Jun, 2008 - 06:49 AM) *

I normally do not use a db file name. I use a connection string in my system settings and its something like this "Data Source=YourServerName;Initial Catalog=YourDataBaseName;Persist Security Info=True;User ID=YourUserName;Password=YourPassoword"



This post has been edited by jayman9: 27 Jun, 2008 - 09:16 AM
User is offlineProfile CardPM

Go to the top of the page

motcom
post 27 Jun, 2008 - 04:31 AM
Post #5


New D.I.C Head

*
Joined: 16 Jun, 2008
Posts: 7

What Error do you get when trying to connect and how do you edit the tables (with what program)?
User is offlineProfile CardPM

Go to the top of the page

joe.lim
post 3 Jul, 2008 - 07:34 PM
Post #6


New D.I.C Head

*
Joined: 9 Jun, 2008
Posts: 8

QUOTE(motcom @ 27 Jun, 2008 - 04:31 AM) *

What Error do you get when trying to connect and how do you edit the tables (with what program)?


Some unhandle exception error and it says "Invalid connection string attribute". I can't seems to get the stsem to run on a LAN environment too. Same error, even when the system run on the host system, when I try to connect from a different PC i'll get the same error on that PC. The tables are edited in visual studio 2005.

Thanks for your help man.
User is offlineProfile CardPM

Go to the top of the page

motcom
post 8 Jul, 2008 - 02:45 AM
Post #7


New D.I.C Head

*
Joined: 16 Jun, 2008
Posts: 7

try removing "Provider=SQLNCLI" and instead of "Server=.\SQLExpress" try "Server=YourserverName or IP address\SQLExpress" also what is your conn?

I use "Imports System.Data.SqlClient" and
dim Conn as new sqlconnection
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/12/08 03:28AM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month