#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    5
    Rep Power
    0

    Update DataSaet to MySQL


    I get a error message from my .aspx which I try to insert a new record into MySQL with DataSet, MySqlProv.3.0. Anyone know where is the problem?

    Error message:
    Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information.

    My coding:

    Dim objCon As OleDbConnection
    Dim objDataAdapter As OleDbDataAdapter
    Dim strDbCon As String
    Dim count As Integer

    strDbCon = "Provider=MySqlProv.3.0;Data Source=atp;"
    objCon = New OleDbConnection(strDbCon)
    objDataAdapter = New OleDbDataAdapter("Select * from member", objCon)
    Dim objCmdBilder As OleDbCommandBuilder = New OleDbCommandBuilder(objDataAdapter)

    Dim objDataSet As DataSet = New DataSet
    objDataAdapter.Fill(objDataSet, "member")
    Dim objDataRow As DataRow = objDataSet.Tables("member").NewRow()

    objDataRow("memberName") = memberName.Text
    objDataRow("memberNameC") = memberNameC.Text
    objDataRow("languageId") = languageId.SelectedIndex

    objDataSet.Tables("member").Rows.Add(objDataRow)
    count = objDataAdapter.Update(objDataSet, "member")
    If count = 1 Then
    msg.Text = "successful!"
    Else
    msg.Text = "fail"
    End If

    objCon.Close()


    Many thanks!! Have a nice day!

    Bella

    Comments on this post

    • Gran Roguismo agrees
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Location
    Bavaria, Germany
    Posts
    140
    Rep Power
    13
    Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information.
    ADO.Net makes heavy use of the schema information of your database and i guess your MySQL driver (or mysql itself) doesn't support returning enough information to generate the dynamic INSERT/UPDATE/DELETE statement called/generated by the DataSet.

    IMHO you need to generate your sql statements by yourself (if you stick to using MySQL - or try another provider if there's one...) :-/

IMN logo majestic logo threadwatch logo seochat tools logo