943,712 Members | Top Members by Rank

Ad:
Dec 4th, 2007
0

using variable in datasource in visual basic 6

Expand Post »
Greetings!

Im using this format to use and open database


Set ac = New ADODB.Connection
Set ar = New ADODB.Recordset

strconek = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\record.mdb;Persist Security Info=False"

i want to use variable value in my data source.

my database is record.mdb. i want to make syntax for this that replace the data source value or the database that i want to use database depend on my given filename..

for example my databasefilename is "file.mdb". Then, my strconek value also change in this format

if the database file is not existing. I want to copy other database to use in my program and to avoid error..

for example : my filename is "file.mdb" first is check this database from the original path or drive. if this filename or database not found. I want to copy the existing database in this filename "copy the file record.mdb to file.mdb"

strconek = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\file.mdb;Persist Security Info=False"

'same routine

if i give another database filename then my strconek value in the datasource also change..
but first is to check the file if existing or not. if existing open the file. if not copy the other database to this filename..


in this case my "strconek" value is okey..

thanks in advance
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
locsin is offline Offline
47 posts
since Aug 2007
Dec 4th, 2007
0

Re: using variable in datasource in visual basic 6

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Styling a text field</title></head> <body><fieldset><legend>Text Field Effects</legend> <form action="" method="get"><input name="Search" type="text" value="Search" maxlength="200" /></form></fieldset> </body></html><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Styling a text field</title>
</head>

<body>
<fieldset><legend>Text Field Effects</legend>

<form action="" method="get">
<input name="Search" type="text" value="Search" maxlength="200" />
</form>
</fieldset>

</body>
</html>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
thekickers2006 is offline Offline
1 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: month format in visual basic 6
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Help needed with VB Assignment





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC