www.webdeveloper.com
Results 1 to 2 of 2

Thread: problem in VB.Net

  1. #1
    Join Date
    Jun 2013
    Posts
    1

    problem in VB.Net

    i have a problem in my SQL syntax : error message:-
    check the manual that corresponds to your MySQL server
    version for the right syntax to use near 'example' at line 1
    here is my syntax:-
    Dim conn As New MySqlConnection
    Dim comm As New MySqlCommand


    conn.ConnectionString = "Server=localhost; user id = root; password= 505664555; database = Eng"
    comm.Connection = conn
    conn.Open()


    comm.CommandText = "Insert into `Eng`.`Eng.info` ('Attendance','Leave','Date') values('" & TextBox1.Text & "', '" & TextBox2.Text & "','" & TextBox3.Text & "')"
    comm.ExecuteNonQuery()
    If MsgBox("Information Successfully saved! / Account Generation Succeed!", MsgBoxStyle.Information, "Information Generation") Then
    MessageBox.Show("Saved", "successful")
    TextBox1.Clear()
    TextBox2.Clear()
    TextBox3.Clear()

    -my problem is in "comm.ExecuteNonQuery()

  2. #2
    Join Date
    May 2013
    Location
    Surendranagar Gujarat India
    Posts
    55
    Hi..

    lets look a simple proc

    create procedure foo @value int out
    as
    set @value=1
    return 2

    then in code

    comm.CommandText = "foo";
    paramValue = comm.CreateParameter();
    paramValue.ParameterName = "@Value";
    paramValue.DbType = DbType.Int32;
    paramValue.Direction = ParameterDirection.Output;
    comm.Parameters.Add(paramValue);

    paramReturn = comm.CreateParameter();
    paramReturn.ParameterName = "@Success";
    paramReturn.DbType = DbType.Int32;
    paramReturn.Direction = ParameterDirection.ReturnValue;
    comm.Parameters.Add(paramReturn);

    comm.ExecuteNonQuery();

    now

    paramValue.Value will equal 1
    paramReturn.Value will equal 2

    Gaurav Pandya
    Web Developer
    Insight Softech
    www.insightsoftech.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles