|
-
Oct 27th, 2013, 09:17 AM
#1
Thread Starter
Member
Want vb6 code to attach sql server database
I Want vb6 code to attach sql server database So when any one install the program it works without need to attach database
and many thanks for all
-
Oct 27th, 2013, 09:21 AM
#2
Frenzied Member
Re: Want vb6 code to attach sql server database
No need for any Code .just package your exe and related database file .using Package and deployment wizard .see the following link for more detail.
http://msdn.microsoft.com/en-us/libr...(v=vs.60).aspx
-
Oct 27th, 2013, 09:47 AM
#3
Thread Starter
Member
Re: Want vb6 code to attach sql server database
firoz-raj Thank you for Reply But this project with SQL SERVER DATABASE AND Must be Attached SO That The Program Can Connect To It
-
Oct 27th, 2013, 10:25 AM
#4
Re: Want vb6 code to attach sql server database
Can you explain what you mean with attach a database?
Is there an SQL Server database already up and running and you need to connect to it?
Or do you need to do an install of SQL server and your application?
-
Oct 27th, 2013, 10:51 AM
#5
Thread Starter
Member
Re: Want vb6 code to attach sql server database
I need to do an install of SQL server and my application And the database file to be attached on the sql server from my vb6 code . so any one can install my program with sql express in the installation file and when he run program first time the database will be attached to the server
-
Oct 27th, 2013, 11:36 AM
#6
Re: Want vb6 code to attach sql server database
You can attach a database using a connection string (which you use in the normal way), such as this one:
Server=.\SQLExpress; AttachDbFilename=C:\MyFolder\MyDataFile.mdf;Database=dbname;Trusted_Connection=Yes;
Source: http://www.connectionstrings.com/sql-server/ , also contains this note:
Why is the Database parameter needed? If the named database have already been attached, SQL Server does not reattach it. It uses the attached database as the default for the connection.
-
Oct 28th, 2013, 12:26 AM
#7
Thread Starter
Member
Re: Want vb6 code to attach sql server database
Can I Do This With VB6
I USE This Connection String
DataEnvironment1.Connection1.ConnectionString = "Provider=SQLOLEDB.1;OLE DB Services = -2 ;Password=Mypass;Persist Security Info=True; User ID=sa;Initial Catalog=DBNAME;Data Source = 192.168.0.1 "
-
Oct 28th, 2013, 06:16 AM
#8
Frenzied Member
Re: Want vb6 code to attach sql server database
change the connection string like the following .
Server=.\SQLExpress;AttachDbFilename=C:\MyFolder\MyDataFile.mdf;Database=dbname;Trusted_Connection=Y es;
Server=.\SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf;Database=dbname; Trusted_Connection=Yes;
-
Oct 28th, 2013, 07:01 AM
#9
Re: Want vb6 code to attach sql server database
 Originally Posted by dawoud66
Can I Do This With VB6
Yes, it may just be as simple as adding the part I highlighted to your current connection string.
I recommend you ignore firoz.raj's post, as he has (once again) posted something that he should know is wrong.
-
Oct 28th, 2013, 08:57 AM
#10
Thread Starter
Member
Re: Want vb6 code to attach sql server database
si_the_geek : Is Your connection will be done with SQL Server 2000 , 2005 ,2008 and 2012
-
Oct 28th, 2013, 09:06 AM
#11
Frenzied Member
Re: Want vb6 code to attach sql server database
Yes, it may just be as simple as adding the part I highlighted to your current connection string.
I recommend you ignore firoz.raj's post, as he has (once again) posted something that he should know is wrong.
brother how it is wrong ?.
Server=.\SQLExpress;AttachDbFilename=C:\MyFolder\MyDataFile.mdf;Database=dbname;Trusted_Connection=Yes;
-
Oct 28th, 2013, 12:05 PM
#12
Re: Want vb6 code to attach sql server database
 Originally Posted by dawoud66
si_the_geek : Is Your connection will be done with SQL Server 2000 , 2005 ,2008 and 2012
I'm not sure which versions support it (I'm fairly certain that 2008 onwards all do), so that is something you will need to research (there should be info on msdn.microsoft.com ) or find out by testing.
 Originally Posted by firoz.raj
brother how it is wrong ?.
Server=.\SQLExpress;AttachDbFilename=C:\MyFolder\MyDataFile.mdf;Database=dbname;Trusted_Connection=Yes;
That part is wrong because it is an exact copy of what I posted (so you were just wasting the time of everybody who read it).
The other connection string you posted is wrong because it is for .Net rather than VB6
Tags for this Thread
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
|