Wrox Home  
Search P2P Archive for: Go

  Return to Index  

activex_data_objects thread: ASP and remote SQL database update/insert


Message #1 by "Sasi Vellolil" <sasiv@a...> on Wed, 20 Nov 2002 03:10:00
ATL_SPC1 is the database server
Webleads is the name of the databas
admin.DiagActivation is the name of the table
Keyretun is the field in the above table

I have another field called "serialnumber" in the above table.
How will I write a value to this field?

Usin the code below I can access the database and read the
fields of the table. Now how to update a field and how to
insert record into a table?

Please help me with some code samples?

<%
set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=SQLOLEDB;Data Source=ATL_SPC1;Initial 
Catalog=Webleads;UserID=IUSR_SASIVELLOLIL;Password=atchan"

set rs = Server.CreateObject("ADODB.recordset")
rs.Open "Select * from webleads.admin.DiagActivation",conn
		    
while Not rs.EOF
Response.Write(rs.Fields("keyreturn") )
rs.MoveNext
Wend

%>


Message #2 by "Steve Wark" <stevewark@c...> on Wed, 20 Nov 2002 14:54:33 +1100
set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=SQLOLEDB;Data Source=ATL_SPC1;Initial 
Catalog=Webleads;UserID=IUSR_SASIVELLOLIL;Password=atchan"

set rs = Server.CreateObject("ADODB.recordset")
rs.Open "update webleads.admin.DiagActivation set keyreturn='ABC' where
keyreturn='DEF'", conn


-----Original Message-----
From: Sasi Vellolil [mailto:sasiv@a...] 
Sent: Wednesday, 20 November 2002 3:10 AM
To: ActiveX_Data_Objects
Subject: [activex_data_objects] ASP and remote SQL database
update/insert

ATL_SPC1 is the database server
Webleads is the name of the databas
admin.DiagActivation is the name of the table
Keyretun is the field in the above table

I have another field called "serialnumber" in the above table.
How will I write a value to this field?

Usin the code below I can access the database and read the
fields of the table. Now how to update a field and how to
insert record into a table?

Please help me with some code samples?

<%
set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=SQLOLEDB;Data Source=ATL_SPC1;Initial 
Catalog=Webleads;UserID=IUSR_SASIVELLOLIL;Password=atchan"

set rs = Server.CreateObject("ADODB.recordset")
rs.Open "Select * from webleads.admin.DiagActivation",conn
		    
while Not rs.EOF
Response.Write(rs.Fields("keyreturn") )
rs.MoveNext
Wend

%>



Message #3 by Sasi Vellolil <sasiv@a...> on Wed, 20 Nov 2002 12:47:18 -0500
Steve,

Thank you very much. It worked.

One more favour.

How can I add a new row (record) to an existing table?

I am very new to DBs and VBscript. So I will appreciate
some sample code as you did for table update.

Agian thanks a million

Regards
Sasi

> -----Original Message-----
> From:	Steve Wark [SMTP:stevewark@c...]
> Sent:	Tuesday, November 19, 2002 10:55 PM
> To:	ActiveX_Data_Objects
> Subject:	[activex_data_objects] RE: ASP and remote SQL database
> update/insert
> 
> 
> set conn = Server.CreateObject("ADODB.Connection")
> conn.open "Provider=SQLOLEDB;Data Source=ATL_SPC1;Initial 
> Catalog=Webleads;UserID=IUSR_SASIVELLOLIL;Password=atchan"
> 
> set rs = Server.CreateObject("ADODB.recordset")
> rs.Open "update webleads.admin.DiagActivation set keyreturn='ABC' where
> keyreturn='DEF'", conn
> 
> 
> -----Original Message-----
> From: Sasi Vellolil [mailto:sasiv@a...] 
> Sent: Wednesday, 20 November 2002 3:10 AM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] ASP and remote SQL database
> update/insert
> 
> ATL_SPC1 is the database server
> Webleads is the name of the databas
> admin.DiagActivation is the name of the table
> Keyretun is the field in the above table
> 
> I have another field called "serialnumber" in the above table.
> How will I write a value to this field?
> 
> Usin the code below I can access the database and read the
> fields of the table. Now how to update a field and how to
> insert record into a table?
> 
> Please help me with some code samples?
> 
> <%
> set conn = Server.CreateObject("ADODB.Connection")
> conn.open "Provider=SQLOLEDB;Data Source=ATL_SPC1;Initial 
> Catalog=Webleads;UserID=IUSR_SASIVELLOLIL;Password=atchan"
> 
> set rs = Server.CreateObject("ADODB.recordset")
> rs.Open "Select * from webleads.admin.DiagActivation",conn
> 		    
> while Not rs.EOF
> Response.Write(rs.Fields("keyreturn") )
> rs.MoveNext
> Wend
> 
> %>
> 
> 
> 
> 
Message #4 by "Steve Wark" <stevewark@c...> on Thu, 21 Nov 2002 06:07:01 +1100
The commands being used to select, update and insert data are SQL, you
need to do some reading and experimentation with these commands and
variations of them.

To insert a record the SQL command can be like;

rs.Open "insert into webleads.admin.DiagActivation (keyreturn, field1,
field2) values ('ABC',120.23,'Some more text')", conn


Regards
Steve

-----Original Message-----
From: Sasi Vellolil [mailto:sasiv@a...] 
Sent: Thursday, 21 November 2002 4:47 AM
To: ActiveX_Data_Objects
Subject: [activex_data_objects] RE: ASP and remote SQL database update
/insert

Steve,

Thank you very much. It worked.

One more favour.

How can I add a new row (record) to an existing table?

I am very new to DBs and VBscript. So I will appreciate
some sample code as you did for table update.

Agian thanks a million

Regards
Sasi

> -----Original Message-----
> From:	Steve Wark [SMTP:stevewark@c...]
> Sent:	Tuesday, November 19, 2002 10:55 PM
> To:	ActiveX_Data_Objects
> Subject:	[activex_data_objects] RE: ASP and remote SQL database
> update/insert
> 
> 
> set conn = Server.CreateObject("ADODB.Connection")
> conn.open "Provider=SQLOLEDB;Data Source=ATL_SPC1;Initial 
> Catalog=Webleads;UserID=IUSR_SASIVELLOLIL;Password=atchan"
> 
> set rs = Server.CreateObject("ADODB.recordset")
> rs.Open "update webleads.admin.DiagActivation set keyreturn='ABC'
where
> keyreturn='DEF'", conn
> 
> 
> -----Original Message-----
> From: Sasi Vellolil [mailto:sasiv@a...] 
> Sent: Wednesday, 20 November 2002 3:10 AM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] ASP and remote SQL database
> update/insert
> 
> ATL_SPC1 is the database server
> Webleads is the name of the databas
> admin.DiagActivation is the name of the table
> Keyretun is the field in the above table
> 
> I have another field called "serialnumber" in the above table.
> How will I write a value to this field?
> 
> Usin the code below I can access the database and read the
> fields of the table. Now how to update a field and how to
> insert record into a table?
> 
> Please help me with some code samples?
> 
> <%
> set conn = Server.CreateObject("ADODB.Connection")
> conn.open "Provider=SQLOLEDB;Data Source=ATL_SPC1;Initial 
> Catalog=Webleads;UserID=IUSR_SASIVELLOLIL;Password=atchan"
> 
> set rs = Server.CreateObject("ADODB.recordset")
> rs.Open "Select * from webleads.admin.DiagActivation",conn
> 		    
> while Not rs.EOF
> Response.Write(rs.Fields("keyreturn") )
> rs.MoveNext
> Wend
> 
> %>
> 
> 
> 
> 



  Return to Index