Groups | Blog | Home
all groups > sql server programming > june 2004 >

sql server programming : SQL CMD string is wrong... HELP !!!!!


Nigel Rivett
6/26/2004 5:36:01 PM
Try the access forum but

cmd = "SELECT * FROM ProcessLog Where rstProcessLog!InputFilenameWithoutpath
= FileNameWithExtensionButNoPath"

I'm guessing that FileNameWithExtensionButNoPath is a literal in which case

cmd = "SELECT * FROM ProcessLog Where rstProcessLog!InputFilenameWithoutpath
= ""FileNameWithExtensionButNoPath"""

or if a variable
cmd = "SELECT * FROM ProcessLog Where rstProcessLog!InputFilenameWithoutpath
= """ & FileNameWithExtensionButNoPath & """"
Dial ISDN Newsgroups
6/26/2004 6:54:50 PM
I have code that looks like below.

I get this error: Run-time error -2147217904 (80040e10) No value given
for one or more required parameters.

I know it is in the CMD string that is wrong. Can anyone help.

Below is code:

Dim cnn1 As ADODB.Connection

Dim rstProcessLog As ADODB.Recordset ' Corresponds to Table: ProcessLog
Dim SqlString As String
Dim cmd As String

Set cnn1 = New ADODB.Connection
cnn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " &
DataBasePathAndFileName & ";Persist Security Info=False"
cnn1.ConnectionTimeout = 30
cnn1.Open
' Display the state of the connections.
GetState (cnn1.State)

Set rstProcessLog = New ADODB.Recordset
rstProcessLog.CursorType = adOpenDynamic
rstProcessLog.LockType = adLockBatchOptimistic

cmd = "SELECT * FROM ProcessLog Where rstProcessLog!InputFilenameWithoutpath
= FileNameWithExtensionButNoPath"

rstProcessLog.Open cmd, cnn1, , , adCmdText


thajeer
6/27/2004 10:42:01 PM
See my answers

[quoted text, click to view]

You need not give rstProcessLog!InputFilenameWithoutpath in the SQL query .. Jus form an SQL string here which will return some records from the table .. yow may want to wite something like this ..

cmd = "SELECT * FROM ProcessLog Where InputFilenameWithoutpath > = '" & strFileNameWithExtensionButNoPath & "'"

if strFileNameWithExtensionButNoPath is a variable in your vb prog ..

[quoted text, click to view]


Cheers !!
AddThis Social Bookmark Button