Results 1 to 5 of 5

Thread: [RESOLVED][2005] MYSQL parameter problem

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2007
    Posts
    87

    Resolved [RESOLVED][2005] MYSQL parameter problem

    As the title says:

    I got a problem using parameters in the mysql.data.client.mysqlcommand


    This is my code:

    Code:
    Dim querystring As String
            querystring = "INSERT INTO tblpicture(data) VALUES(@Picture)"
            Dim QueryT As New MySqlCommand(querystring, connection)
            QueryT.Parameters.Add("@Picture", MySqlDbType.String)
            QueryT.Parameters(0).Value = "hello"
            Console.WriteLine(QueryT.Parameters.Item(0).Value)
            Console.WriteLine(QueryT.CommandText)
    QueryT.ExecuteNonQuery() ' causes the error
    error: #23000Column 'data' cannot be null

    Data column i set was set to NOT NULL

    I got truely no idea what is goeing wrong here.

    I am planning on saving banairy data in the database and saw this as the only solution. It doesnt matter with what kind of datatype i try it, it wont work. So this was for people who wanted to ask why i dont just add the string in de string.

    These are the 2 lines from the output.:

    Code:
    hello
    INSERT INTO tblpicture(data) VALUES(@Picture)
    So the parrams realy work as you see. I can read them out if i want to.
    But the problem is that the value is not sended to the database.

    Is there someone that can help me with it?

    Greets
    Last edited by ovanwijk; Jan 2nd, 2008 at 06:31 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width