Re: ASP.NET and Mysql connector .net 1.0.7
Posted by: joe sambuco
Date: December 28, 2006 12:54PM

How about some samples?
INSERT:
Dim myConnection As New MySql.Data.MySqlClient.MySqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionSql"))
Dim myQuery As String = "INSERT INTO tbl_XXXX (first_name, last_name, middle_initial) VALUES ('" & txtFName.Text & "','" & txtLName.Text & "','" & txtMidInit.Text & "')"
Dim myCommand As New MySql.Data.MySqlClient.MySqlCommand(myQuery)

Try
myConnection.Open()
myCommand.Connection = myConnection
myCommand.ExecuteNonQuery()
Catch ex As Exception
Dim strErrormsg = ex.Message
Finally
myConnection.Close()
End Try

SELECT into Array:
Dim myData = New ArrayList
Dim myConnection As New MySql.Data.MySqlClient.MySqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionSql"))
Dim mySelectQuery As String = "SELECT id, first_name, last_name, middle_initial, FROM tbl_XXX WHERE id = '" & txtid.Text & "'"
Dim myCommand As New MySql.Data.MySqlClient.MySqlCommand(mySelectQuery, myConnection)
Dim myReader As MySqlDataReader


Try
myConnection.Open()
myReader = myCommand.ExecuteReader()
myReader.Read()

myData.add(myReader.GetString(0))
myData.add(myReader.GetString(1))
myData.add(myReader.GetString(2))
myData.add(myReader.GetString(3))



Edited 1 time(s). Last edit at 12/28/2006 12:57PM by joe sambuco.

Options: ReplyQuote


Subject
Written By
Posted
Re: ASP.NET and Mysql connector .net 1.0.7
December 28, 2006 12:54PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.