Groups > Asp .Net > Data Access and ObjectDataSource Control > Re: OledbException No value given for one or more required parameters.




OledbException No value given for one or more required
parameters.

OledbException No value given for one or more required parameters.
Thu, 3 Apr 2008 02:14:06 +0000
This is wierd I created a query in MS Access and am trying to use it and ADO.NET
and am getting the following error. 

OledbException No value given for one or more required parameters.

Does this sql look ok?

"SELECT tblProps.PropId, tblProps.PropName, tblProps.Address1,
tblProps.Address2, tblProps.City, tblProps.State, tblProps.Zip, tblProps.County,
tblProps.PropImgUrl, tblProps.AffiliateId, tblProps.PropType,
tblProps.TransactionType, tblListings.SqFt FROM tblProps INNER JOIN tblListings
ON tblProps.PropId = tblListings.PropId"

What I really want to do is put a WHERE clause on the end of it but I'd have to
get this to work first. My ado code looks like this.

Try
            cn.Open()
            Dim reader As OleDbDataReader = com.ExecuteReader
            While reader.Read
                Dim prop As New ManageProps.Prop

                prop.PropId = IIf(IsDBNull(reader("PropId")), 0,
reader("PropId"))
                prop.PropName = IIf(IsDBNull(reader("PropName")),
"", reader("PropName"))
                prop.Add1 = IIf(IsDBNull(reader("Address1")),
"", reader("Address1"))
                prop.Add2 = IIf(IsDBNull(reader("Address2")),
"", reader("Address2"))
                prop.City = IIf(IsDBNull(reader("City")),
"", reader("City"))
                prop.State = IIf(IsDBNull(reader("State")),
"", reader("State"))
                prop.Zip = IIf(IsDBNull(reader("Zip")), "",
reader("Zip"))
                prop.County = IIf(IsDBNull(reader("County")),
"", reader("County"))
                prop.PropImgUrl = IIf(IsDBNull(reader("PropImgUrl")),
"", reader("PropImgUrl"))
                prop.AffiliateId =
IIf(IsDBNull(reader("AffiliateId")), "",
reader("AffiliateId"))
                prop.PropType = IIf(IsDBNull(reader("PropType")),
"", reader("PropType"))
                prop.TransactionType =
IIf(IsDBNull(reader("TransactionType")), "",
reader("TransactionType"))

            End While
        Catch ex As Exception
            Throw New Exception
        Finally
            cn.Close()
        End Try

 Any help is appreciated.

:-)
Post Reply
Re: OledbException No value given for one or more required parameters.
Thu, 3 Apr 2008 04:18:45 +0000
First of all check if fields and columns that you are trying to populate are
really exists in your database. Second - check if any of input paramaters have '
symbol - in positive case you have a sql injection:) remole all such symbols
Post Reply
about | contact