|
 |
access_asp thread: calling an access query in update form
Message #1 by jenniferwuebbels@y... on Fri, 21 Mar 2003 04:35:41
|
|
This is my last resort...
I am going thru the examples in the book (Beginning ASP Databases) and I
am trying to populate an updatable form that I can navigate thru (1
record per page, it being a form 'n all..) Well, I started out using a
recordset to get out of using a stored procedure (cause I am using access
and hence there is the problem) so I am trying to call my query using the
command object but now I don't know how to populate the form from the
query. My connection code is:
<%
'Coded by Jennifer Wuebbels, 2001
Option Explicit
'ADO variables
Dim objConn
Dim objCmd
Dim adCmdText
adCmdText = 1
'Connection Object
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open = "richwjr-listings"
'Command Object
Set objCmd = Server.CreateObject("ADODB.Command")
Set objCmd.ActiveConnection = objConn
objCmd.CommandText = "{call qryHomes}"
objCmd.CommandType = adCmdText
objCmd.Execute
'Loop through the recordset
Do While Not rs_Homes.EOF
%>
and an example of how I'm populating the textboxes is like this:
<input type="text" name="txtID<%=rs_Homes("ID")%>">
and I don't know how to change it. Also having problems navigating.
Thank you very much.
Jennifer
Message #2 by "Josh Katsaros" <katsarosj@y...> on Fri, 21 Mar 2003 15:41:06
|
|
If you are trying to set your form fields equal to values from the database
(and i think this is what you are trying to do), try this instead:
<input type="text" name="txtID" value="<%=rs_Homes("ID")%>">
Hope this helps.
JK
> This is my last resort...
I> am going thru the examples in the book (Beginning ASP Databases) and I
a> m trying to populate an updatable form that I can navigate thru (1
r> ecord per page, it being a form 'n all..) Well, I started out using a
r> ecordset to get out of using a stored procedure (cause I am using
access
a> nd hence there is the problem) so I am trying to call my query using
the
c> ommand object but now I don't know how to populate the form from the
q> uery. My connection code is:
<> %
'> Coded by Jennifer Wuebbels, 2001
O> ption Explicit
'> ADO variables
D> im objConn
D> im objCmd
D> im adCmdText
a> dCmdText = 1
'> Connection Object
S> et objConn = Server.CreateObject("ADODB.Connection")
o> bjConn.Open = "richwjr-listings"
'> Command Object
S> et objCmd = Server.CreateObject("ADODB.Command")
S> et objCmd.ActiveConnection = objConn
o> bjCmd.CommandText = "{call qryHomes}"
o> bjCmd.CommandType = adCmdText
o> bjCmd.Execute
> 'Loop through the recordset
D> o While Not rs_Homes.EOF
%> >
> and an example of how I'm populating the textboxes is like this:
<> input type="text" name="txtID<%=rs_Homes("ID")%>">
a> nd I don't know how to change it. Also having problems navigating.
T> hank you very much.
J> ennifer
Message #3 by jenniferwuebbels@y... on Fri, 21 Mar 2003 21:02:35
|
|
Thank you very much. How can I get it to navigate correctly? I am trying
to use images for the buttons to navigate between records and it doesn't
like that so I had to take the rs.MoveNext(), etc out of the buttons. I
am having one for save, one for delete, new record, and then the basic
navigation arrows. Thanks,
Jenn
> If you are trying to set your form fields equal to values from the
database
(> and i think this is what you are trying to do), try this instead:
> <input type="text" name="txtID" value="<%=rs_Homes("ID")%>">
> Hope this helps.
> JK
>
>> This is my last resort...
I> > am going thru the examples in the book (Beginning ASP Databases)
and I
a> > m trying to populate an updatable form that I can navigate thru (1
r> > ecord per page, it being a form 'n all..) Well, I started out using
a
r> > ecordset to get out of using a stored procedure (cause I am using
a> ccess
a> > nd hence there is the problem) so I am trying to call my query using
t> he
c> > ommand object but now I don't know how to populate the form from the
q> > uery. My connection code is:
<> > %
'> > Coded by Jennifer Wuebbels, 2001
O> > ption Explicit
'> > ADO variables
D> > im objConn
D> > im objCmd
D> > im adCmdText
a> > dCmdText = 1
'> > Connection Object
S> > et objConn = Server.CreateObject("ADODB.Connection")
o> > bjConn.Open = "richwjr-listings"
'> > Command Object
S> > et objCmd = Server.CreateObject("ADODB.Command")
S> > et objCmd.ActiveConnection = objConn
o> > bjCmd.CommandText = "{call qryHomes}"
o> > bjCmd.CommandType = adCmdText
o> > bjCmd.Execute
> > 'Loop through the recordset
D> > o While Not rs_Homes.EOF
%> > >
> > and an example of how I'm populating the textboxes is like this:
<> > input type="text" name="txtID<%=rs_Homes("ID")%>">
a> > nd I don't know how to change it. Also having problems navigating.
T> > hank you very much.
J> > ennifer
Message #4 by "Josh Katsaros" <katsarosj@y...> on Sat, 22 Mar 2003 17:44:03
|
|
What does your code look like for the navigation? I don't see any place
in the code that posted listing any rs paging.
JK
> Thank you very much. How can I get it to navigate correctly? I am trying
t> o use images for the buttons to navigate between records and it doesn't
l> ike that so I had to take the rs.MoveNext(), etc out of the buttons. I
a> m having one for save, one for delete, new record, and then the basic
n> avigation arrows. Thanks,
J> enn
>
>> If you are trying to set your form fields equal to values from the
d> atabase
(> > and i think this is what you are trying to do), try this instead:
> > <input type="text" name="txtID" value="<%=rs_Homes("ID")%>">
> > Hope this helps.
> > JK
> >
>> > This is my last resort...
I> > > am going thru the examples in the book (Beginning ASP Databases)
a> nd I
a> > > m trying to populate an updatable form that I can navigate thru (1
r> > > ecord per page, it being a form 'n all..) Well, I started out using
a>
r> > > ecordset to get out of using a stored procedure (cause I am using
a> > ccess
a> > > nd hence there is the problem) so I am trying to call my query
using
t> > he
c> > > ommand object but now I don't know how to populate the form from
the
q> > > uery. My connection code is:
<> > > %
'> > > Coded by Jennifer Wuebbels, 2001
O> > > ption Explicit
'> > > ADO variables
D> > > im objConn
D> > > im objCmd
D> > > im adCmdText
a> > > dCmdText = 1
'> > > Connection Object
S> > > et objConn = Server.CreateObject("ADODB.Connection")
o> > > bjConn.Open = "richwjr-listings"
'> > > Command Object
S> > > et objCmd = Server.CreateObject("ADODB.Command")
S> > > et objCmd.ActiveConnection = objConn
o> > > bjCmd.CommandText = "{call qryHomes}"
o> > > bjCmd.CommandType = adCmdText
o> > > bjCmd.Execute
> > > 'Loop through the recordset
D> > > o While Not rs_Homes.EOF
%> > > >
> > > and an example of how I'm populating the textboxes is like this:
<> > > input type="text" name="txtID<%=rs_Homes("ID")%>">
a> > > nd I don't know how to change it. Also having problems navigating.
T> > > hank you very much.
J> > > ennifer
Message #5 by jenniferwuebbels@y... on Sat, 22 Mar 2003 19:08:31
|
|
I deleted it because it didn't work. I originally attached
rs_Homes.MoveNext() to the image (honestly I did it several different
ways and none of them worked.) So I took them out to just concentrate on
getting the form to populate first
Jenn
> What does your code look like for the navigation? I don't see any
place
i> n the code that posted listing any rs paging.
> JK
> > Thank you very much. How can I get it to navigate correctly? I am
trying
t> > o use images for the buttons to navigate between records and it
doesn't
l> > ike that so I had to take the rs.MoveNext(), etc out of the buttons.
I
a> > m having one for save, one for delete, new record, and then the
basic
n> > avigation arrows. Thanks,
J> > enn
> >
>> > If you are trying to set your form fields equal to values from the
d> > atabase
(> > > and i think this is what you are trying to do), try this instead:
> > > <input type="text" name="txtID" value="<%=rs_Homes("ID")%>">
> > > Hope this helps.
> > > JK
> > >
>> > > This is my last resort...
I> > > > am going thru the examples in the book (Beginning ASP
Databases)
a> > nd I
a> > > > m trying to populate an updatable form that I can navigate thru
(1
r> > > > ecord per page, it being a form 'n all..) Well, I started out
using
a> >
r> > > > ecordset to get out of using a stored procedure (cause I am
using
a> > > ccess
a> > > > nd hence there is the problem) so I am trying to call my query
u> sing
t> > > he
c> > > > ommand object but now I don't know how to populate the form from
t> he
q> > > > uery. My connection code is:
<> > > > %
'> > > > Coded by Jennifer Wuebbels, 2001
O> > > > ption Explicit
'> > > > ADO variables
D> > > > im objConn
D> > > > im objCmd
D> > > > im adCmdText
a> > > > dCmdText = 1
'> > > > Connection Object
S> > > > et objConn = Server.CreateObject("ADODB.Connection")
o> > > > bjConn.Open = "richwjr-listings"
'> > > > Command Object
S> > > > et objCmd = Server.CreateObject("ADODB.Command")
S> > > > et objCmd.ActiveConnection = objConn
o> > > > bjCmd.CommandText = "{call qryHomes}"
o> > > > bjCmd.CommandType = adCmdText
o> > > > bjCmd.Execute
> > > > 'Loop through the recordset
D> > > > o While Not rs_Homes.EOF
%> > > > >
> > > > and an example of how I'm populating the textboxes is like this:
<> > > > input type="text" name="txtID<%=rs_Homes("ID")%>">
a> > > > nd I don't know how to change it. Also having problems
navigating.
T> > > > hank you very much.
J> > > > ennifer
Message #6 by "Josh Katsaros" <katsarosj@y...> on Sun, 23 Mar 2003 02:38:40
|
|
It's a little harder to do than that with asp. You have to tell it a few
more details like Pagesize, Pagecount, and Absolutepage. There are
several tutorials out there that you can look at. Here is one at
ASPFree.com:
http://www.aspfree.com/authors/bipin/adorecordsetpaging.asp
That should get you started. Once you have this code worked the way you
want it, put it in an include file, or make it into a component so that
you can call it easily or with only a few modifications.
:)
JK
> I deleted it because it didn't work. I originally attached
r> s_Homes.MoveNext() to the image (honestly I did it several different
w> ays and none of them worked.) So I took them out to just concentrate on
g> etting the form to populate first
J> enn
> > What does your code look like for the navigation? I don't see any
p> lace
i> > n the code that posted listing any rs paging.
> > JK
> > > Thank you very much. How can I get it to navigate correctly? I am
t> rying
t> > > o use images for the buttons to navigate between records and it
d> oesn't
l> > > ike that so I had to take the rs.MoveNext(), etc out of the
buttons.
I>
a> > > m having one for save, one for delete, new record, and then the
b> asic
n> > > avigation arrows. Thanks,
J> > > enn
> > >
>> > > If you are trying to set your form fields equal to values from the
d> > > atabase
(> > > > and i think this is what you are trying to do), try this instead:
> > > > <input type="text" name="txtID" value="<%=rs_Homes("ID")%>">
> > > > Hope this helps.
> > > > JK
> > > >
>> > > > This is my last resort...
I> > > > > am going thru the examples in the book (Beginning ASP
D> atabases)
a> > > nd I
a> > > > > m trying to populate an updatable form that I can navigate thru
(> 1
r> > > > > ecord per page, it being a form 'n all..) Well, I started out
u> sing
a> > >
r> > > > > ecordset to get out of using a stored procedure (cause I am
u> sing
a> > > > ccess
a> > > > > nd hence there is the problem) so I am trying to call my query
u> > sing
t> > > > he
c> > > > > ommand object but now I don't know how to populate the form
from
t> > he
q> > > > > uery. My connection code is:
<> > > > > %
'> > > > > Coded by Jennifer Wuebbels, 2001
O> > > > > ption Explicit
'> > > > > ADO variables
D> > > > > im objConn
D> > > > > im objCmd
D> > > > > im adCmdText
a> > > > > dCmdText = 1
'> > > > > Connection Object
S> > > > > et objConn = Server.CreateObject("ADODB.Connection")
o> > > > > bjConn.Open = "richwjr-listings"
'> > > > > Command Object
S> > > > > et objCmd = Server.CreateObject("ADODB.Command")
S> > > > > et objCmd.ActiveConnection = objConn
o> > > > > bjCmd.CommandText = "{call qryHomes}"
o> > > > > bjCmd.CommandType = adCmdText
o> > > > > bjCmd.Execute
> > > > > 'Loop through the recordset
D> > > > > o While Not rs_Homes.EOF
%> > > > > >
> > > > > and an example of how I'm populating the textboxes is like this:
<> > > > > input type="text" name="txtID<%=rs_Homes("ID")%>">
a> > > > > nd I don't know how to change it. Also having problems
n> avigating.
T> > > > > hank you very much.
J> > > > > ennifer
|
|
 |