|
Thread: F8
-
Jun 1st, 2008, 06:06 AM
#1
Thread Starter
Junior Member
-
Jun 1st, 2008, 06:09 AM
#2
Frenzied Member
Re: F8
Code:
could you please check this code for me
Yeah we Can.
But unfortunately you have used the [INVISIBLE] tags, so we cant see the code.
Please post the code with [CODE] tags.
Thanks
-
Jun 1st, 2008, 06:22 AM
#3
Thread Starter
Junior Member
Re: F8
thank you for your response
Private Sub ConnectToServer1(y As String)
procedure:
Dim StrSQL As String
On Error GoTo ErrMsg
Set rsMCare = New ADODB.Recordset
Set rsMCare.ActiveConnection = cnMCare
y = y & " , " & Format(Now, "HH:MM:SS")
'y = y
' insert the value in the StuId table
StrSQL = "insert into STUID VALUES("" & y & "");"
rsMCare.Source = StrSQL
rsMCare.Open
If rsMCare.State = 1 Then rsMCare.Close
Exit Sub
ErrMsg:
MsgBox "Error: " & Err.Description
End Sub
Private Sub Form_Unload(Cancel As Integer)
InRFIDCtrl1.Close
End Sub
Public Function ConnectToServer() As Boolean
'On Error Goto ErrMsg
Set cnMCare = New ADODB.Connection
' here is the name,user and the password of the database
cnMCare.Open "Provider=MSDAORA;DSN=coe485;uid=yosef;pwd=coe485"
If cnMCare = adStateOpen Then
MsgBox "Welcome to Pubs!"
Else
MsgBox "Sorry. No Pubs today."
End If
'cnMCare.Open "Provider=MSDASQL;DSN=;uid=user;pwd=password"
Set rsMCare = New ADODB.Recordset
cnMCare.CursorLocation = adUseClient
rsMCare.CursorType = adOpenStatic 'use for reports only
rsMCare.CursorLocation = adUseClient
rsMCare.LockType = adLockPessimistic
Set rsMCare.ActiveConnection = cnMCare
ConnectToServer = True
Exit Function
ErrMsg:
MsgBox Err.Description
ConnectToServer = False
Exit Function
End Function
Public Status As Integer
Public cnMCare As ADODB.Connection
Public rsMCare As ADODB.Recordset
Public rsMCare1 As ADODB.Recordset
Public rsMCare2 As ADODB.Recordset
(Rate)
-
Jun 1st, 2008, 06:26 AM
#4
Re: F8
Thread moved to Database Development forum
As you haven't mentioned which line the error occurs on, there isn't much we can do about that. (you can find generic advice on this error in the "fixing common VB errors" link in my signature).
Note that the way you build StrSQL is not apt (it will contain the text (" & y & ") , not the value of your variable y). See the SQL section of our Database Development FAQs/Tutorials (at the top of this forum)
There is also no need to use a Recordset to run it (it is a waste of CPU time, memory, and network usage), see the "How do I add a record" article in the ADO section of the FAQs, which shows how to use the Connection instead.
-
Jun 1st, 2008, 06:39 AM
#5
Thread Starter
Junior Member
-
Jun 1st, 2008, 07:06 AM
#6
Re: F8
To be able to help you any more than we have, you need to give us more information.
If you want help with the error, tell us where it occurs.
If you want help with something else, give us an explanation of what.
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
|