|
-
May 10th, 2007, 05:04 AM
#1
Thread Starter
New Member
i can't save Records to Access Database
hi
i used Textbox,Combobox and Checkbox in form ...
from that .. input records to database .. but ... i can't save
Dim mycon As New OleDbConnection(connstring)
Dim mycmd As New OleDbCommand("INSERT INTO DailyR_tbl (DateIn,DName,Holiday,ComID,DepID,SecID,StaffName,9-10AM,10-11AM,11-12AM,1-2PM,2-3PM,3-4PM,4-5PM) VALUES ( '" & CDate(txtDate.Text) & "','" & Daycombo.SelectedValue.ToString & "','" & Holidaychbox.CheckState.ToString & "','" & Comcombo.SelectedValue.ToString & "','" & Depcombo.SelectedValue.ToString & "','" & Seccombo.SelectedValue.ToString & "','" & Staffcombo.SelectedValue.ToString & "','" & txtJob1.Text & "','" & txtJob2.Text & "','" & txtJob3.Text & "','" & txtJob4.Text & "','" & txtJob5.Text & "','" & txtJob6.Text & "','" & txtJob7.Text & "')", mycon)
If (mycon.State = ConnectionState.Closed) Then
mycon.Open()
End If
Try
mycmd.ExecuteNonQuery()
mycon.Close()
mycon.Dispose()
MessageBox.Show("save successfully")
Catch ex As Exception
MessageBox.Show("Can't Save")
End Try
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|