Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL connect

Status
Not open for further replies.

RemingtonSteel

Programmer
Jul 14, 2006
65
GB
How am I gonna use SQLEXECUTE when I need to deal with multiple tables? I understand, SQLConnect only connect to one database handle.

Thanks.
Remi
 
one database or one table?

SQLconnect connects to one database and then you can query and manipulate all the tables that belong to that Database.

Ali Koumaiha
Wireless Toyz
Farmington Hills, Michigan
 
Ali,
I tried the sqlexec command. However, Why is it that when I execute the Update statement inside sqlconnect; it didn't update the SQL Table?

Is there any command that I'm missing.

Example is the command I used.

updateme ="Update aUser setUserID='lma',FirstName='Lance',LastName='Martinez'"

=sqlexec(dbconn,updateme)

Thanks!
 
just briefly looking at your update statement.

Code:
updateme =[Update aUser set UserID='lma',FirstName='Lance',LastName='Martinez']

I noticed you had the SET command without a space next to the USER ID.

Was it a typo?





Ali Koumaiha
Wireless Toyz
Farmington Hills, Michigan
 
I tried it, the update works! Thanks a lot.
However,I tried the insert but it not successful?

insertme ="Insert into aUser(UserID,FirstName,LastName) values ('CMA','Czarina','Villa')"

=sqlexec(conn,insertme)

I don't see any typo this time.

Any idea?
Thanks.
 
insertme ="Insert into aUser(UserID,FirstName,LastName) values ('CMA','Czarina','Villa')"

Put a space after aUser and the (.

Code:
Insert Into aUser (UserID....)

Ali Koumaiha
Wireless Toyz
Farmington Hills, Michigan
 
RemingtonSteel,

A couple of suggestions.

Whenever you call SQLEXEC(), always test the returned value. If it is -1, it means that an error occurred. You can then use AERROR() to find the nature of the error. Often, it will be a simple syntax error or something similar, and you'll be able to fix it straight away.

Secondly, you don't say which back-end database you are using, but most back ends have their own command interpreter or "immediate mode" (in SQL Server 2000, for example, it's called the Query Analyzer). If you are having trouble debugging a SQLEXEC(), try pasting the comamnd into the interpreter and running it from there. With luck, you'll get an informative message if it fails, and other debugging information.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top