|
 |
asp_databases thread: data entry
Message #1 by "Navnit Bhatia" <nav78@u...> on Fri, 27 Apr 2001 10:31:08
|
|
Hi, anyone could help me with this code
<%
dim rs
set rs=Server.CreateObject("ADODB.RecordSet")
'rs.Open "insert into Table11(username,password,firstname,lastname) values
('" & username & "','" & password & "','" & firstname & "','" & lastname
& "' )",myConn,adOpenDynamic
rs.addnew
rs.fields("username")= Request.Form ("username")
rs.fields("password")= Request.Form ("password")
rs.fields("firstname")= Request.Form ("firstname")
rs.fields("lastname")= Request.Form ("lastname")
rs.update
rs.Close
myConn.Close
%>
As i cannot add data by using Addnew object.
Message #2 by "Tomm Matthis" <matthis@b...> on Fri, 27 Apr 2001 06:47:37 -0400
|
|
Why would you want to do a SQL insert and then do rs.AddNew....
The SQL statement you have does not return a recordset, that is why your
Addnew is failing.
the SQL statement should be a SELECT statement in that case.
Tomm
> -----Original Message-----
> From: Navnit Bhatia [mailto:nav78@u...]
> Sent: Friday, April 27, 2001 10:31 AM
> To: ASP Databases
> Subject: [asp_databases] data entry
>
>
> Hi, anyone could help me with this code
>
>
> <%
> dim rs
> set rs=Server.CreateObject("ADODB.RecordSet")
> 'rs.Open "insert into Table11(username,password,firstname,lastname) values
> ('" & username & "','" & password & "','" & firstname & "','" & lastname
> & "' )",myConn,adOpenDynamic
> rs.addnew
> rs.fields("username")= Request.Form ("username")
> rs.fields("password")= Request.Form ("password")
> rs.fields("firstname")= Request.Form ("firstname")
> rs.fields("lastname")= Request.Form ("lastname")
> rs.update
> rs.Close
> myConn.Close
> %>
>
> As i cannot add data by using Addnew object.
>
>
Message #3 by "Navnit Bhatia" <nav78@u...> on Fri, 27 Apr 2001 12:57:07
|
|
> Why would you want to do a SQL insert and then do rs.AddNew....
>
> The SQL statement you have does not return a recordset, that is why your
> Addnew is failing.
>
> the SQL statement should be a SELECT statement in that case.
>
> Tomm
>
> > -----Original Message-----
> > From: Navnit Bhatia [mailto:nav78@u...]
> > Sent: Friday, April 27, 2001 10:31 AM
> > To: ASP Databases
> > Subject: [asp_databases] data entry
> >
> >
> > Hi, anyone could help me with this code
> >
> >
> > <%
> > dim rs
> > set rs=Server.CreateObject("ADODB.RecordSet")
> > 'rs.Open "insert into Table11(username,password,firstname,lastname)
values
> > ('" & username & "','" & password & "','" & firstname & "','" &
lastname
> > & "' )",myConn,adOpenDynamic
> > rs.addnew
> > rs.fields("username")= Request.Form ("username")
> > rs.fields("password")= Request.Form ("password")
> > rs.fields("firstname")= Request.Form ("firstname")
> > rs.fields("lastname")= Request.Form ("lastname")
> > rs.update
> > rs.Close
> > myConn.Close
> > %>
> >
> > As i cannot add data by using Addnew object.
Thankx but i think u did not get the code i have commented the insert
statement. The connection works well, i can view the record everythin is
working fine except for the addnew object. Why is that so?
Message #4 by "Tomm Matthis" <matthis@b...> on Fri, 27 Apr 2001 08:52:51 -0400
|
|
Ok... if the current code is "working" then how are you getting a
recordset to work with? I see the instantiation line, but the rs.open is
commented out... therefore, *where* is the recordset comming from and
what type of cursor are you specifying when its opened?
Tomm
> -----Original Message-----
> From: Navnit Bhatia [mailto:nav78@u...]
> Sent: Friday, April 27, 2001 12:57 PM
> To: ASP Databases
> Subject: [asp_databases] RE: data entry
>
>
> > Why would you want to do a SQL insert and then do rs.AddNew....
> >
> > The SQL statement you have does not return a recordset, that is why
your
> > Addnew is failing.
> >
> > the SQL statement should be a SELECT statement in that case.
> >
> > Tomm
> >
> > > -----Original Message-----
> > > From: Navnit Bhatia [mailto:nav78@u...]
> > > Sent: Friday, April 27, 2001 10:31 AM
> > > To: ASP Databases
> > > Subject: [asp_databases] data entry
> > >
> > >
> > > Hi, anyone could help me with this code
> > >
> > >
> > > <%
> > > dim rs
> > > set rs=3DServer.CreateObject("ADODB.RecordSet")
> > > 'rs.Open "insert into
Table11(username,password,firstname,lastname)
> values
> > > ('" & username & "','" & password & "','" & firstname & "','" &
> lastname
> > > & "' )",myConn,adOpenDynamic
> > > rs.addnew
> > > rs.fields("username")=3D Request.Form ("username")
> > > rs.fields("password")=3D Request.Form ("password")
> > > rs.fields("firstname")=3D Request.Form ("firstname")
> > > rs.fields("lastname")=3D Request.Form ("lastname")
> > > rs.update
> > > rs.Close
> > > myConn.Close
> > > %>
> > >
> > > As i cannot add data by using Addnew object.
>
> Thankx but i think u did not get the code i have commented the insert
> statement. The connection works well, i can view the record everythin
is
> working fine except for the addnew object. Why is that so?
>
Message #5 by "Ken Schaefer" <ken@a...> on Sat, 28 Apr 2001 00:18:49 +1000
|
|
You are not opening the recordset (you have commented this line out)
objRS.Open "tablename", objConn, adOpenForwardOnly, adLockOptimistic,
adCmdTableDirect
is what you need.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Navnit Bhatia" <nav78@u...>
To: "ASP Databases" <asp_databases@p...>
Sent: Friday, April 27, 2001 12:57 PM
Subject: [asp_databases] RE: data entry
: > Why would you want to do a SQL insert and then do rs.AddNew....
: >
: > The SQL statement you have does not return a recordset, that is why your
: > Addnew is failing.
: >
: > the SQL statement should be a SELECT statement in that case.
: >
: > Tomm
: >
: > > -----Original Message-----
: > > From: Navnit Bhatia [mailto:nav78@u...]
: > > Sent: Friday, April 27, 2001 10:31 AM
: > > To: ASP Databases
: > > Subject: [asp_databases] data entry
: > >
: > >
: > > Hi, anyone could help me with this code
: > >
: > >
: > > <%
: > > dim rs
: > > set rs=Server.CreateObject("ADODB.RecordSet")
: > > 'rs.Open "insert into Table11(username,password,firstname,lastname)
: values
: > > ('" & username & "','" & password & "','" & firstname & "','" &
: lastname
: > > & "' )",myConn,adOpenDynamic
: > > rs.addnew
: > > rs.fields("username")= Request.Form ("username")
: > > rs.fields("password")= Request.Form ("password")
: > > rs.fields("firstname")= Request.Form ("firstname")
: > > rs.fields("lastname")= Request.Form ("lastname")
: > > rs.update
: > > rs.Close
: > > myConn.Close
: > > %>
: > >
: > > As i cannot add data by using Addnew object.
:
: Thankx but i think u did not get the code i have commented the insert
: statement. The connection works well, i can view the record everythin is
: working fine except for the addnew object. Why is that so?
:
: ---
: SoftArtisans helps developers build robust, scalable Web applications!
: Excel Web reports, charts: http://www.softartisans.com/excelwriter.html
: File uploads: http://www.softartisans.com/saf.html
: Transactional file management: http://www.softartisans.com/saf1.html
: Scalability: http://www.softartisans.com/saxsession.html
: ASPstudio value pack: http://www.softartisans.com/aspstudiosuite.html
$subst('Email.Unsub')
|
|
 |