0

My code is

Dim tmpSQL_2 = New StringBuilder
        tmpSQL_2.AppendLine("Insert into table(tbl_ID,tbl_Type,tbl_Type) ")
        tmpSQL_2.AppendLine(" VALUES ")
        tmpSQL_2.AppendLine("(@tbl_ID,@tbl_Type,@tbl_Type) ")
        Using tmpCMD As New OleDbCommand(tmpSQL_2.ToString, conn)
            tmpCMD.Parameters.AddWithValue("@tbl_ID", "0")
            tmpCMD.Parameters.AddWithValue("@tbl_Type", "my type")
            tmpCMD.Parameters.AddWithValue("@tbl_Ser_Id", "my type")
            tmpCMD.ExecuteNonQuery()
        End Using

for inserting into table but it is not working.

I'm not getting any error also. what should be the problem ?

1 Answer 1

1

Try it in defferent way ...

Dim cmdText As String = "INSERT INTO table(tbl_ID,tbl_Type,tbl_Type) VALUES (?,?,?)"
Dim cmd As SqlCommand = New OleDBCommand(cmdText, conn)

With cmd.Parameters
    .Add("@p1", OleDbType.Integer).Value = 0
    .Add("@p2", OleDbType.VarChar).Value = "my type"
    .Add("@p3", OleDbType.VarChar).Value = "my type"       
End With
cmd.ExecuteNonQuery()
Sign up to request clarification or add additional context in comments.

2 Comments

@RahulShirphule .. I just changed those 3 lines .. it's updated
@RahulShirphule .. it's changed .. for accessDB

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.