E
Eniac0
Hi,
I've searched the groups a lot before posting. Even tho a lot of people
posted with the same error, none of the solution worked for me.
Here's what not working. I am going to post the whole function on .net
side and in access so you see for yourself...
I am getting the error -> Parameter "strUser" has no default value.
Just so you know, I have tried with and without [ and ]. I also tried
with "@strUser" when calling from ADO. I have other "select" stored
procedures with parameters and they work fine. Maybe its because of the
varchar type ? this is my only SP with varchars as params.
Thanks for your help.
Stephane.
####################
Function processLogin(ByVal pstrUser As String, ByVal pstrPassword As
String) As DataSet
Dim da As OleDbDataAdapter = Nothing
Dim ds As DataSet = Nothing
Dim conn As OleDbConnection = Nothing
Dim cmd As OleDbCommand = Nothing
Dim paramUser As OleDbParameter = Nothing
Dim paramPassword As OleDbParameter = Nothing
Try
paramUser = New OleDbParameter
With paramUser
.ParameterName = "strUser"
.OleDbType = OleDbType.VarChar
.Size = 10
.Value = pstrUser
.Direction = ParameterDirection.Input
End With
paramPassword = New OleDbParameter
With paramPassword
.ParameterName = "strPassword"
.OleDbType = OleDbType.VarChar
.Size = 10
.Value = pstrPassword
.Direction = ParameterDirection.Input
End With
conn = New OleDbConnection(connectionString)
cmd = New OleDbCommand
cmd.Connection = conn
cmd.CommandText = "EXECUTE spLogin"
cmd.Parameters.Add(paramUser)
cmd.Parameters.Add(paramPassword)
da = New OleDbDataAdapter
da.SelectCommand = cmd
ds = New DataSet
da.Fill(ds)
Catch ex As Exception
Throw ex
Finally
If conn.State <> ConnectionState.Closed Then
conn.Close()
End If
conn.Dispose()
cmd.Dispose()
da.Dispose()
End Try
##############
Here is the MS Access 2002 "stored procedure". When i run it in access,
everything runs fine.
PARAMETERS strUser Text ( 255 ), strPassword Text ( 255 );
SELECT Count(c.icContact) AS Expr1
FROM tblContact AS c
WHERE [c.cUsername]=[strUser] And [c.cMotDePasse]=[strPassword];
Return ds
End Function
I've searched the groups a lot before posting. Even tho a lot of people
posted with the same error, none of the solution worked for me.
Here's what not working. I am going to post the whole function on .net
side and in access so you see for yourself...
I am getting the error -> Parameter "strUser" has no default value.
Just so you know, I have tried with and without [ and ]. I also tried
with "@strUser" when calling from ADO. I have other "select" stored
procedures with parameters and they work fine. Maybe its because of the
varchar type ? this is my only SP with varchars as params.
Thanks for your help.
Stephane.
####################
Function processLogin(ByVal pstrUser As String, ByVal pstrPassword As
String) As DataSet
Dim da As OleDbDataAdapter = Nothing
Dim ds As DataSet = Nothing
Dim conn As OleDbConnection = Nothing
Dim cmd As OleDbCommand = Nothing
Dim paramUser As OleDbParameter = Nothing
Dim paramPassword As OleDbParameter = Nothing
Try
paramUser = New OleDbParameter
With paramUser
.ParameterName = "strUser"
.OleDbType = OleDbType.VarChar
.Size = 10
.Value = pstrUser
.Direction = ParameterDirection.Input
End With
paramPassword = New OleDbParameter
With paramPassword
.ParameterName = "strPassword"
.OleDbType = OleDbType.VarChar
.Size = 10
.Value = pstrPassword
.Direction = ParameterDirection.Input
End With
conn = New OleDbConnection(connectionString)
cmd = New OleDbCommand
cmd.Connection = conn
cmd.CommandText = "EXECUTE spLogin"
cmd.Parameters.Add(paramUser)
cmd.Parameters.Add(paramPassword)
da = New OleDbDataAdapter
da.SelectCommand = cmd
ds = New DataSet
da.Fill(ds)
Catch ex As Exception
Throw ex
Finally
If conn.State <> ConnectionState.Closed Then
conn.Close()
End If
conn.Dispose()
cmd.Dispose()
da.Dispose()
End Try
##############
Here is the MS Access 2002 "stored procedure". When i run it in access,
everything runs fine.
PARAMETERS strUser Text ( 255 ), strPassword Text ( 255 );
SELECT Count(c.icContact) AS Expr1
FROM tblContact AS c
WHERE [c.cUsername]=[strUser] And [c.cMotDePasse]=[strPassword];
Return ds
End Function