Vote count: 0
Dim Query As String
Dim con As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=Minimarket;Integrated Security=True")
Query = "INSERT INTO Barang(kode_bar,kode_kat,nama_bar,satuan, hbeli, hjual, stok, expired)VALUES("
Query = Query + txtkodebar.Text + ",'" + cmbkodekat.Text + "','" + txtnamabar.Text + "','" + txtsatuan.Text + "','" + txthbeli.Text + "','" + txthjual.Text + "','" + txtstok.Text + "','" + Format(dtpex.Text, "yyyy-MM-dd HH:mm:ss") + "'"
con.Open()
Dim cmd As SqlCommand = New SqlCommand(Query, con)
Dim i As Integer = cmd.ExecuteNonQuery()
If (i > 0) Then
MessageBox.Show("Data berhasil disimpan")
Else
MessageBox.Show("Data gagal disimpan")
End If
con.Close()
*there is anyone can help me ? when i press button save there is error incorrect syntax near ',' in cmd.executenonquery . what i must doing now ? i fell give up :'( *
asked 3 mins ago
command error *incorrect syntax near ','*
Aucun commentaire:
Enregistrer un commentaire