i making a program that will sort or index the table in foxpro, i use sql code to generate the code in visual basic 6.0 but it has always an error.. i'm using ado data control, and here are my codes..
Adodc1.ConnectionString = "Provider=VFPOLEDB.1;Data Source=G:Documents and SettingsDP2205DesktopDataEnvironment;Password="";Collating Sequence=MACHINE" Adodc1.RecordSource = " SELECT Books.book_id, Books.title, Books.topic_id, Books.copyright_year, " _ & " Books.isbn_number, Books.publisher_name, Books.purchase_price," _ & " Books.covertype, Books.date_purchased, Books.pages, Books.notes" _ & " FROM books!books" _ & " ORDER BY copyright_year DESC" Adodc1.Refresh Set DataGrid1.DataSource = Adodc1
error is Run time error '3001':
Applicant-defined of object-defined error
Arguments are of the wrong type, are out of acceptable range, or are conflict with one another
Yes sir, I can connect to the database but i can't create a query on it..
The error message seems to imply a call to a function or procedure using an incorrect set of parameters.
The only procedure call I see in the code you posted is the call to Adodc1.Refresh, which is most likely using the ConnectionString to connect to the database and execute the query, so, if there is no more code involved the problem must be in the connection string or the query.
ConnectionString is a string and as such it is defined inside double quotes, but inside it you have another pair of quotes for the password, which could be causing the error. Try removing those inner quotes.
Also, since it's been about 20 years since I used FoxPro for the last time, I'm not sure if "books!books" is a correct way to reference a table.
thnx for the reply,,your right refresh has always a problem,,
the qoutes in the password indicate that there is no password,,
and the books!books come form the foxpro its self,,i made a query in the foxpro and
copy it to the vb6,,so i think its not the problem,,
i hope for more recommendation,,
thnx again for your time sir,,
I know the quotes in the password indicate that there is no password, but if you are including a double quoted string inside another string, you usually need to escape the inner quotes.
Did you try my suggestion of removing those inner quotes ?
Something like this:
Adodc1.ConnectionString = "Provider=VFPOLEDB.1;Data Source=G:\Documents and Settings\DP2205\Desktop\DataEnvironment;Password=;Collating Sequence=MACHINE"
Also, make sure the data source (and its path) is correct.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
Discuss This Question: 5  Replies