473,503 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help! ado connection string variable

link
71 New Member
hi everyone,

please help me on how to put my data path in variable. I'm using ADO and my database is visual foxpro 6 and I'm using visual basic 6.

this is my connection string:
Provider=VFPOLEDB.1;Data Source=D:\2007\01\18;Mode=Read;Password="";Collati ng Sequence=GENERAL

my recordsource is:
t_tran.dbf

it worked properly if i put my connection string in ado properties but when putting it in a variable it won't work anymore.

the t_tran.dbf is placed in different folder on every each day. which means, if today is jan, 18, 2007 then the directory would be c:\2007\01\18\t_tran.dbf and tomorrow, the data path will change because the date will be c:\2007\01\19.

So my option in opening the database is to select the date, then the path will change to the specific date.

Hope I explained it correctly.

Thanks in advance :)
Jan 18 '07 #1
3 2437
Killer42
8,435 Recognized Expert Expert
Can you show us the existing code? Replacing a hard-coded literal with a variable sounds simple, but there's always something that we weren't aware of.
Jan 19 '07 #2
Killer42
8,435 Recognized Expert Expert
...
this is my connection string:
Provider=VFPOLEDB.1;Data Source=D:\2007\01\18;Mode=Read;Password="";Collati ng Sequence=GENERAL
...
I'll take a quick stab at it. Sorry if this is not what you're after, but I'm using a lot of guess-work here. :)
Expand|Select|Wrap|Line Numbers
  1. Dim strConn As String
  2. strConn = "Provider=VFPOLEDB.1;Data Source=D:\" _
  3.   & format(Year(Now()) _
  4.   & "\" _
  5.   & Format(Month(Now(),"00") _
  6.   & "\" _
  7.   & Format(Day(Now(),"00") _
  8.   & ";Mode=Read;Password="""";Collating Sequence=GENERAL"
Jan 19 '07 #3
link
71 New Member
I'll take a quick stab at it. Sorry if this is not what you're after, but I'm using a lot of guess-work here. :)
Expand|Select|Wrap|Line Numbers
  1. Dim strConn As String
  2. strConn = "Provider=VFPOLEDB.1;Data Source=D:\" _
  3.   & format(Year(Now()) _
  4.   & "\" _
  5.   & Format(Month(Now(),"00") _
  6.   & "\" _
  7.   & Format(Day(Now(),"00") _
  8.   & ";Mode=Read;Password="""";Collating Sequence=GENERAL"
thanks Killer42,

here is my code...

Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection

Private Sub Form_Load()

cn.Open ("Provider=VFPOLEDB.1;Data Source=D:\;Mode=Read;Password="";Collating Sequence=MACHINE")
rs.Open "select * from t_tran", cn

End Sub

I'm using ADO and datagrid, it works when i'm only using their properties but can't make it in coding.

I want to view the data using datagrid and put the data source as variable...example as

xdata = "d:\"
Data Source=xdata

then view the content of the database using datagrid...is this possible sir?

thanks
Jan 26 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

21
6485
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
9
4374
by: Tom | last post by:
A question for gui application programmers. . . I 've got some GUI programs, written in Python/wxPython, and I've got a help button and a help menu item. Also, I've got a compiled file made with...
4
3321
by: Sarir Khamsi | last post by:
Is there a way to get help the way you get it from the Python interpreter (eg, 'help(dir)' gives help on the 'dir' command) in the module cmd.Cmd? I know how to add commands and help text to...
6
2983
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect...
5
2961
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
5
3249
by: Steve | last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp My expectation is that a developer using my DLL would be able to access this help file during his development time...
8
3206
by: Mark | last post by:
I have loaded Visual Studio .net on my home computer and my laptop, but my home computer has an abbreviated help screen not 2% of the help on my laptop. All the settings look the same on both...
10
3327
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
1
6111
by: trunxnirvana007 | last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' 'UPGRADE_WARNING: Couldn't resolve...
0
2848
by: hitencontractor | last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003. I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About. The application...
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.