data type mismatch

Results 1 to 3 of 3

Thread: data type mismatch

  1. #1
    Join Date
    Dec 1969

    Default data type mismatch

    Whenever i envoke a function with the following code I get:<BR>"Data type mismatch in criteria expression." <BR>Note: Info is coming from 2 EditCommandColumns.<BR>Data base is access "bids" is set to data type currency<BR>if I replace the @bid and @item_id with eg. 12 and 34.34 it works. Any advice? Thanks<BR><BR>MY SQL String:<BR> Dim strSQL = "UPDATE auction_bids SET [bids] =@bid where item_id=@item_id"<BR><BR>&#039;Getting values from datagrid<BR>Dim item_id As Integer = e.Item.Cells(1).Text<BR>Dim bid As Double = CType(e.Item.Cells(3).Controls(0), TextBox).Text<BR><BR>&#039;putting values in parameter<BR> Dim parameterItemID As OleDbParameter = _<BR> New OleDbParameter("@item_id", OleDbType.Integer)<BR> parameterItemID.Value = item_id<BR> objCmd.Parameters.Add(parameterItemID)<BR><BR><BR> Dim parameterBid As OleDbParameter = _<BR> New OleDbParameter("@bid", OleDbType.Currency)<BR> parameterBid.Value = bid<BR> objCmd.Parameters.Add(parameterBid)

  2. #2
    Join Date
    Dec 1969

    Default RE: data type mismatch

    try<BR>Dim bid As Decimal

  3. #3
    Join Date
    Dec 1969

    Default The 'in criteria expression' means...

    ...that the problem is in the WHERE clause.<BR><BR>Not to ask a silly question, but why don&#039;t you forget the OleDbParameter stuff and just build the SQL string directly:<BR><BR>Dim strSQL = "UPDATE auction_bids SET [bids]=" & CSTR(bid) & " WHERE item_id=" & CSTR(item_id)<BR><BR>???<BR><BR>The parameters are great for complex queries and the like but for something as simple as this?<BR><BR>If that doesn&#039;t work, then dump the SQL out to the browser and take a look at what you are actually inflicting on it.<BR><BR>

Posting Permissions

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