J
Jesper Jensen
I have the following problem:
I have created the following SQL for my app. With the below shown code
(Example 1) I am able to retrieve the records I need into dataset
dsFind.
Now however I want to do another search as in Example 2, this doesnt
work and I get no records.
However if I switch around the order of the parameters as seen in
Example 3 I get my records after EfterNavn.
This makes it difficult to make an SQL with more criterias like:
SQLFindString = "SELECT PersonsInfo.* FROM PersonsInfo"
SQLFindString = SQLFindString & " WHERE (EfterNavn = ?) AND ([By] =
?)"
So my question what is wrong with my parameter addition to the
parameter collection. I cant believe it matters what the order is of
the parameter declarations. If anyone has any experience with this,
please post a reply.
Best regards,
Jesper Jensen
Example 3:
daPersons.SelectCommand.Parameters.Add("EfterNavn", OleDbType.VarChar,
70).Value = EfterNavn
daPersons.SelectCommand.Parameters.Add("[By]", OleDbType.VarChar,
50).Value = By
Example 2:
SQLFindString = "SELECT PersonsInfo.* FROM PersonsInfo"
SQLFindString = SQLFindString & " WHERE (EfterNavn = ?)"
Example 1:
Dim SQLFindString As String = ""
Dim iniWhere As Boolean = False
SQLFindString = "SELECT PersonsInfo.* FROM PersonsInfo"
SQLFindString = SQLFindString & " WHERE ([By] = ?)"
OleDbSelectCommand1 = New OleDbCommand(SQLFindString)
daPersons.SelectCommand = OleDbSelectCommand1
OleDbSelectCommand1.Connection = DbCon
daPersons.SelectCommand.Parameters.Add("[By]", OleDbType.VarChar,
50).Value = By
daPersons.SelectCommand.Parameters.Add("EfterNavn", OleDbType.VarChar,
70).Value = EfterNavn
daPersons.Fill(dsFind, "PersonsInfo")
datGrid.SetDataBinding(dsFind, "PersonsInfo")
I have created the following SQL for my app. With the below shown code
(Example 1) I am able to retrieve the records I need into dataset
dsFind.
Now however I want to do another search as in Example 2, this doesnt
work and I get no records.
However if I switch around the order of the parameters as seen in
Example 3 I get my records after EfterNavn.
This makes it difficult to make an SQL with more criterias like:
SQLFindString = "SELECT PersonsInfo.* FROM PersonsInfo"
SQLFindString = SQLFindString & " WHERE (EfterNavn = ?) AND ([By] =
?)"
So my question what is wrong with my parameter addition to the
parameter collection. I cant believe it matters what the order is of
the parameter declarations. If anyone has any experience with this,
please post a reply.
Best regards,
Jesper Jensen
Example 3:
daPersons.SelectCommand.Parameters.Add("EfterNavn", OleDbType.VarChar,
70).Value = EfterNavn
daPersons.SelectCommand.Parameters.Add("[By]", OleDbType.VarChar,
50).Value = By
Example 2:
SQLFindString = "SELECT PersonsInfo.* FROM PersonsInfo"
SQLFindString = SQLFindString & " WHERE (EfterNavn = ?)"
Example 1:
Dim SQLFindString As String = ""
Dim iniWhere As Boolean = False
SQLFindString = "SELECT PersonsInfo.* FROM PersonsInfo"
SQLFindString = SQLFindString & " WHERE ([By] = ?)"
OleDbSelectCommand1 = New OleDbCommand(SQLFindString)
daPersons.SelectCommand = OleDbSelectCommand1
OleDbSelectCommand1.Connection = DbCon
daPersons.SelectCommand.Parameters.Add("[By]", OleDbType.VarChar,
50).Value = By
daPersons.SelectCommand.Parameters.Add("EfterNavn", OleDbType.VarChar,
70).Value = EfterNavn
daPersons.Fill(dsFind, "PersonsInfo")
datGrid.SetDataBinding(dsFind, "PersonsInfo")