Insert Statement Creating NULL Rows???
Can anyone explain to me why this insert statement is inserting NULL values into my MySQL Database. What I'm doing is pulling information from a FoxPro Table and trying to insert them into MySQL. I know that the dataset contains the needed information and that the rowstate is 4.
--------------------------------------------------------------------------------
Dim vfSQL As String = "SELECT * FROM mysqltest"
Dim conStr As String = "Provider=VFPOLEDB.1;DATA Source=Data;Mode=Share Deny None;Extended Properties=;Encrypt Password=False"
Dim vfCon As New OleDb.OleDbConnection(conStr)
Dim vfDA As New OleDb.OleDbDataAdapter(vfSQL, vfCon)
Dim vfDS As New DataSet
vfDA.AcceptChangesDuringFill = False
vfDA.Fill(vfDS, "mysqltest")
Dim mSQL As String = "SELECT * FROM mysqltest"
conStr = "Persist Security Info=False;database=DDMS;server=localhost;user id=manweb;Password=SQL4144mSs"
Dim mCon As New MySql.Data.MySqlClient.MySqlConnection(conStr)
Dim mDA As New MySql.Data.MySqlClient.MySqlDataAdapter(mSQL, mCon)
mDA.TableMappings.Add("mysqltest", "mysqltest")
Dim iCmd As MySql.Data.MySqlClient.MySqlCommand
iCmd = New MySql.Data.MySqlClient.MySqlCommand("INSERT INTO mysqltest(`fName`, `lName`, `Address`, `City`, `zip`, `state`) VALUE (@fName, @lName, @Address, @City, @Zip, @State)", mCon)
iCmd.Parameters.Add(New MySql.Data.MySqlClient.MySqlParameter("@fName", MySql.Data.MySqlClient.MySqlDbType.VarChar, 10, "fName"))
iCmd.Parameters.Add(New MySql.Data.MySqlClient.MySqlParameter("@lName", MySql.Data.MySqlClient.MySqlDbType.VarChar, 10, "lName"))
iCmd.Parameters.Add(New MySql.Data.MySqlClient.MySqlParameter("@Address", MySql.Data.MySqlClient.MySqlDbType.VarChar, 30, "Address"))
iCmd.Parameters.Add(New MySql.Data.MySqlClient.MySqlParameter("@City", MySql.Data.MySqlClient.MySqlDbType.VarChar, 10, "City"))
iCmd.Parameters.Add(New MySql.Data.MySqlClient.MySqlParameter("@Zip", MySql.Data.MySqlClient.MySqlDbType.Int16, 5, "Zip"))
iCmd.Parameters.Add(New MySql.Data.MySqlClient.MySqlParameter("@state", MySql.Data.MySqlClient.MySqlDbType.VarChar, 2, "state"))
mDA.InsertCommand = iCmd
Response.Write("RowState = " & vfDS.Tables("mysqltest").Rows(0).RowState() & "<br>First Name: " & vfDS.Tables("mysqltest").Rows(0).Item(1))
mDA.Update(vfDS, "mysqltest")
Dim myDS As New DataSet
mDA.Fill(myDS, "mysqltest")