Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sara_baboo
Starting Member
8 Posts |
Posted - 2004-07-08 : 22:44:48
|
| i need to know what is the coding to run .sql file from vb..is it posible...all the coding is in the file..and going to use the vb to execute the coding.any idea...saras |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2004-07-08 : 23:29:59
|
| have the vb run osql cmd line utility with the .sql file as the source parameter. |
 |
|
|
JasonGoff
Posting Yak Master
158 Posts |
Posted - 2004-07-09 : 04:58:05
|
| Assuming VB6...Use a FileSystemObject (or the plain old Open/Read/Close) to open the .SQL file. Read the contents of the file into a buffer.Place the buffered string (the command) into an ADO Command object structure, connected to the database you wish to use.Execute the command.Any errors/feedback will be in the ADO Errors collection.If you want to capture any rows returned from the SQL, then attach a Recordset object as well. |
 |
|
|
sachinsamuel
Constraint Violating Yak Guru
383 Posts |
Posted - 2004-07-09 : 05:16:28
|
| Or else u can create a .bat file in which u can access isql utility of sql server. And then u can execute the bat file using shell function in VB.Please checl BOL for isql.RegardsSachin |
 |
|
|
|
|
|