well this is the code i have to save the data to the db, but it isnt giving any error nor the data is been saved
vb Code:
Private Conn As OleDb.OleDbConnection Private cmd As OleDb.OleDbCommand Private sql As String Private Sub Members_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try Conn = New OleDb.OleDbConnection(My.Settings.DMSConnectionString) cmd = New OleDb.OleDbCommand(sql, Conn) Conn.Open() Catch ex As Exception MessageBox.Show("Error Connecting to Database", "DMS", MessageBoxButtons.OK) Me.Close() End Try End Sub Private Sub CmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSave.Click sql = "INSERT INTO Members ( MemberName, FatherName, Age, Gender, BloodGroup, WorkSection, Occupation, PhotoLink ) " sql &= "Values (@MemberName, @FatherName, @Age, @Gender, @BloodGroup, @WorkSection, @Occupation, @PhotoLink ) " cmd.CommandText = sql cmd.Parameters.AddWithValue("@MemberName", Me.MemberName.Text.Trim) cmd.Parameters.AddWithValue("@FatherName", Me.FatherName.Text.Trim) cmd.Parameters.AddWithValue("@Age", Me.Age.Text.Trim) cmd.Parameters.AddWithValue("@Gender", Me.Gender.Text) cmd.Parameters.AddWithValue("@BloogGroup", Me.BloodGroup.Text) cmd.Parameters.AddWithValue("@WorkSection", Me.WorkSection.Text.Trim) cmd.Parameters.AddWithValue("@Occupation", Me.Occupation.Text.Trim) cmd.Parameters.AddWithValue("@PhotoLink", "") cmd.ExecuteScalar() End Sub Private Sub Members_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Conn.Close() End Sub
plz help





Reply With Quote