Re: How To Execute A Sql Script File From ADO.NET Using VB.NET
From: Lloyd Sheen (sqlguyremoveallofthis_at_tostopspamhotmail.com)
Date: 05/17/04
- Next message: Balint Toth: "newbie question (SQL)"
- Previous message: Soop: "VB ADO.NET Concurrency, Access, date fields and parameters"
- In reply to: SqlJunkies User: "How To Execute A Sql Script File From ADO.NET Using VB.NET"
- Next in thread: William Ryan eMVP: "Re: How To Execute A Sql Script File From ADO.NET Using VB.NET"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 17 May 2004 16:26:17 GMT
You will have to break up the script into it's portions. Remember that GO
is not a T-SQL word. If you know that each GO is on its own line then you
can split the text. Then execute each set of commands within the batch. If
you are expecting no results then use the SQLCommand.ExecuteNonQuery, this
will return the row count.
Ensure that you wrap the execution to ensure that errors are caught. If you
have PRINT statements you will have to capture the InfoMessage event of the
open connection.
Lloyd Sheen
"SqlJunkies User" <User@-NOSPAM-SqlJunkies.com> wrote in message
news:e5C$hZCPEHA.2976@TK2MSFTNGP10.phx.gbl...
> I have a sql script file containing a number of batch commands to create a
new database with 50 tables. Is there anyway i can use ado.net to open this
file and execute the sql command in side in a batch format. Basically I
would like to execute the myscriptfile.sql from vb.net using ado.net
>
> ---
> Posted using Wimdows.net NntpNews Component -
>
> Post Made from http://www.SqlJunkies.com/newsgroups Our newsgroup engine
supports Post Alerts, Ratings, and Searching.
- Next message: Balint Toth: "newbie question (SQL)"
- Previous message: Soop: "VB ADO.NET Concurrency, Access, date fields and parameters"
- In reply to: SqlJunkies User: "How To Execute A Sql Script File From ADO.NET Using VB.NET"
- Next in thread: William Ryan eMVP: "Re: How To Execute A Sql Script File From ADO.NET Using VB.NET"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|