|
-
Nov 22nd, 2000, 12:25 PM
#1
Thread Starter
New Member
I am trying to add a NEW record. I am using VB6 and SQL Server 7 (ADO connectivity).
I KNOW my code is wrong. I'm a beginner and just can't figure this out. I think If I can understand this it will help me overall a great deal. Here's what my code looks like now: (don't laugh)
Private Sub cmdAddNew_Click()
rstAction.AddNew
'Clear the boxes
cboAssignee.Text = ""
cboMeetingName.Text = ""
cboTaskName.Text = ""
txtTaskDescription.Text = ""
txtTargetDate.Text = ""
txtCompleteDate.Text = ""
txtPerformanceRating.Text = ""
txtMeetingDate.Text = Date
txtModDate.Text = ""
txtAssignedBy.Text = ""
' Establish a connection
Set cnSQLConnection = New ADODB.Connection
With cnSQLConnection
.Provider = "SQLOLEDB"
.ConnectionString = "Data Source=ompsv17;User ID=sa;Initial Catalog=MeetingReg"
.Open
End With
' Open a recordset
SQLstr = "SELECT * FROM Action"
Set rstAction = New ADODB.Recordset
rstAction.Open "Select Assignee, MeetingName, TargetDate, TaskDescription, MeetingDate, CompleteDate, PerformanceRating, ModDate, AssignedBy," & _
"TaskName from Action", cnSQLConnection, _
adOpenKeyset, adLockOptimistic
' Bind the text boxes to the recordset object
Set cboAssignee.DataSource = rstAction
cboAssignee.DataField = "Assignee"
Set cboMeetingName.DataSource = rstAction
cboMeetingName.DataField = "MeetingName"
Set cboTaskName.DataSource = rstAction
cboTaskName.DataField = "TaskName"
Set txtTaskDescription.DataSource = rstAction
txtTaskDescription.Text = "TaskDescription"
Set txtTargetDate.DataSource = rstAction
txtTargetDate.Text = "TargetDate"
Set txtCompleteDate.DataSource = rstAction
txtCompleteDate.Text = "CompleteDate"
Set txtPerformanceRating.DataSource = rstAction
txtPerformanceRating.Text = "PerformanceRating"
Set txtMeetingDate.DataSource = rstAction
txtMeetingDate.Text = "MeetingDate"
Set txtModDate.DataSource = rstAction
txtModDate.Text = "ModDate"
Set txtAssignedBy.DataSource = rstAction
txtAssignedBy.Text = "AssignedBy"
End Sub
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
|