Hi all,
Can anyone show or direct me as to where I can learn how to execute a command in which its commandtext was loaded from an external file (i.e. text file).
I've done the basics like the ff:
myScript.txt contents
From experience, this will give an error. The command object's commandtext somehow does not recognize the linefeed and tab characters. Also, in this case, CommandType is CommandType.Text. Using CommandType.StoredPro is another story.
Anyways, just wanna know if anybody else has done something like this or if anyone is familiar to what I'm trying to do. I have posted a thread somewhat similar to this a few months ago. This time I'm having a different problem. Please help.
Thanks
Can anyone show or direct me as to where I can learn how to execute a command in which its commandtext was loaded from an external file (i.e. text file).
I've done the basics like the ff:
VB.NET:
Dim sqlText As String = File.IO.ReadAllText("myScript.txt")
Dim conn As New OracleConnection(myConnString)
Dim cmd As New OracleCommand
With cmd
.Connection=conn
.Connection.Open()
.CommandType = CommandType.Text
.CommandText = sqlText
.ExecuteNonQuery()
End With
myScript.txt contents
VB.NET:
CREATE TABLE myTable
(
col1 NUMBER,
col2 VARCHAR2(10)
);
From experience, this will give an error. The command object's commandtext somehow does not recognize the linefeed and tab characters. Also, in this case, CommandType is CommandType.Text. Using CommandType.StoredPro is another story.
Anyways, just wanna know if anybody else has done something like this or if anyone is familiar to what I'm trying to do. I have posted a thread somewhat similar to this a few months ago. This time I'm having a different problem. Please help.
Thanks