how to insert data into database vb.net

Published: 19 September 2019
on channel: Learn Travel and tech
17
1

copy paste thiis code
and update code according to your requirment
ans see video till end to avoide mistake


Try

If Conn.State = ConnectionState.Closed Then
Conn.Open()
End If

Dim cmd As New OleDb.OleDbCommand
cmd.Connection = Conn
cmd.CommandType = CommandType.Text
cmd.CommandText = "INSERT INTO cash (dated, accnt, actype, detail, refrence, pay) VALUES (@dated, @accnt, @actype, @detail, @refrence, @pay)"

cmd.Parameters.AddWithValue("@dated", Label9.Text.Trim)
cmd.Parameters.AddWithValue("@accnt", ComboBox2.Text.Trim)
cmd.Parameters.AddWithValue("@actype", Label7.Text.Trim)
cmd.Parameters.AddWithValue("@detail", TextBox1.Text.Trim)
cmd.Parameters.AddWithValue("@refrence", Label6.Text.Trim)
cmd.Parameters.AddWithValue("@pay", TextBox2.Text.Trim)


cmd.ExecuteScalar()
Conn.Close()





Catch ex As Exception
MsgBox("Error!: " + ex.ToString)
Exit Sub
End Try


On this page of the site you can watch the video online how to insert data into database vb.net with a duration of hours minute second in good quality, which was uploaded by the user Learn Travel and tech 19 September 2019, share the link with friends and acquaintances, this video has already been watched 17 times on youtube and it was liked by 1 viewers. Enjoy your viewing!