Results 1 to 2 of 2

Thread: Passing parameters to MS access DB

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2006
    Posts
    16

    Passing parameters to MS access DB

    Hi there. I hope someone can help me with this. I am having problems passing parameters to my stored procedure in MS access. I keep getting this error:

    Parameter discovery is not supported for connections using GenericDatabase. You must specify the parameters explicitly, or configure the connection to use a type deriving from Database that supports parameter discovery."} System.NotSupportedException

    This is the code I have been trying, with some earlier things I tried commented out.

    Dim TCCDB As Database = DatabaseFactory.CreateDatabase("TCC")
    Dim sqlQuery As String = "spGetValue1"
    Dim Value1Cmd As Common.DbCommand = TCCDB.GetStoredProcCommand(sqlQuery)
    'Dim Param1 As Common.DbParameter
    'Param1.Value = TotalValue
    'TCCDB.AddInParameter(Value1Cmd, "TotalValue", DbType.Double, TotalValue)
    'TCCDB.AddParameter(Value1Cmd, "@TotalValue", DbType.Decimal, ParameterDirection.Input, "", DataRowVersion.Default, TotalValue)
    'Value1Cmd.Parameters.Add(Param1)
    Dim TotalValueParam As New OleDb.OleDbParameter("@TotalValue", SqlDbType.Decimal)
    Value1Cmd.Parameters.Add(TotalValueParam)
    Value1Cmd.Parameters("@TotalValue").Value = TotalValue
    Try

    Dim VRReader As IDataReader = TCCDB.ExecuteReader(CommandType.StoredProcedure, Value1Cmd)

    If VRReader.Read Then
    Value= VRReader("Value")
    End If

    Catch ex As Exception

    End Try


    Any help would be great. I have been trawling the net with no luck.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Jan 2006
    Posts
    16

    Re: Passing parameters to MS access DB

    Any ideas of web sites I could check for this even? It is driving me crazy at the mo to be stuck on such a simple problem. If I was using sqlclient it'd be done in a second. And looking up Access on google is useless!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width