Parameters in .net (Accessing MS Access)

  • Thread starter Thread starter RICK
  • Start date Start date
R

RICK

In the following code you will note a select statement that says "SELECT *
FROM WebQry_List". The MS Access query needs a single parameter passed to it
to be able to run. How do you add that parameter in the following code. I
have tried parameters.add but am apparently having syntax problems. Please
advise!! Thanks.


<%@ Import Namespace="System.Data.OleDb" %>

<script runat="server">
sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" &
server.mappath("/databases/cpcweb.mdb"))
dbconn.Open()
sql="SELECT * FROM WebQry_List"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
family.DataSource=dbread
family.DataBind()
dbread.Close()
dbconn.Close()
end sub
 
Rick,

I gave you the answer on that already in the message in the other newsgroup.

My intention was that you would read that and ask this kind of questions
next time in this newsgroup, because you asked what was a better newsgroup
for AdoNet questions.

Cor
 
I do have a follow-up.

In my classic pages I am passing those parameters similar to the following:

<%
Set rsTemp = server.createobject("adodb.recordset")
dbconn.WebQry_List varRequestParm, rsTemp
$>

Is there anyway to do that in .net?
 
Why do you not look in that first newsgroup that you visited and where I
gave a sample?

Cor
 
I did take a look at the page that was referenced but unless I am missing
something I don't believe that the parameters are being passed similar to my
follow-up question. If I am missing something, please advise.

Thanks,

Rick
 
From that page

\\\
command.Parameters.Add("@p1", OleDbType.Char, 3).Value = "a")
///

Cor
 
Thanks, So .Value="a" than get replaced with .Value=strValue.

What I am trying to do is to get rid of the sql statements in the code and
get to the query that is written in MS Access.
 
Back
Top