|
-
Jul 15th, 2003, 03:19 PM
#1
Thread Starter
Hyperactive Member
vb.net mysql load a sql file...
has anyone used the mysqldirect .net dataprovider from www.crlab.com? i have a sqlscript file that creates about 100 tables.... now i looked at the mysqlscript component of it but it doesn't give any options to load the file...does anyone know how to load an sql file into a commandtext object? other than reading the sql file opening the file into a textstream an tossing that into a string?
-
Jul 15th, 2003, 05:33 PM
#2
Lively Member
I haven't used the dataprovider you mentioned, but I was able to connect to mySql using ODBC and .NET. I'm not sure I understand your question, but if the ODBC code will help, here it is.
Code:
Imports Microsoft.Data.Odbc
Module Module1
Sub Main()
Dim MyConString As String
Dim myConnection As OdbcConnection
MyConString = "Driver={MySQL ODBC 3.51 Driver};server=localhost;database=people;" & _
"UID=root"
myConnection = New OdbcConnection(MyConString)
Try
myConnection.Open()
' retrieve a record from a table
Dim sql As String = "SELECT * FROM names"
Dim da As New OdbcDataAdapter(sql, myConnection)
Dim ds As New DataSet()
da.Fill(ds, "Names")
myConnection.Close()
Catch MyOdbcException As OdbcException
Console.WriteLine(MyOdbcException.ToString)
Catch MyException As Exception
Console.WriteLine(MyException.ToString)
End Try
End Sub
End Module
-
Jul 15th, 2003, 07:57 PM
#3
Thread Starter
Hyperactive Member
thanks
maybe i should have explained it better...
i have a file called.... mysql.sql and that is where my sql command is i.e. "CREATE DATABASE TEST1" etc...
i want to be able to load the file into my app for my data connection to use with out it messing up formating, if i put it in a string, it does....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|