|
 |
activex_data_objects thread: RE: ASP and remote SQL database update
/insert
Message #1 by Sasi Vellolil <sasiv@a...> on Sat, 30 Nov 2002 21:17:30 -0500
|
|
Steve,
Thank you so much for your help.
I have one last question.
The follwing line works.
rs.Open "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
VALUES (1234,5678)",conn
But if I use:
Dim sasi, ammu
sasi = 1234
ammu = 5678
rs.Open "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
VALUES (sasi,ammu)",conn
I get the error:
"Microsoft OLE DB Provider for SQL Server (0x80040E14)
The name 'sasi' is not permitted in this context.
Only constants, expressions, or variables allowed here.
Column names are not permitted."
Any clue on what is going on?
Regards
Sasi
> -----Original Message-----
> From: Steve Wark [SMTP:stevewark@c...]
> Sent: Wednesday, November 20, 2002 2:07 PM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] RE: ASP and remote SQL database
> update /insert
>
> 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
> >
> > %>
> >
> >
> >
> >
>
>
>
Message #2 by "Steve Wark" <stevewark@c...> on Sun, 1 Dec 2002 18:04:40 +1100
|
|
The whole insert command is a string ie
"insert webleads.admin.DiagActivation (MachineClientID,cftoken)
VALUES (sasi,ammu)"
Therefore it is this string that is passed to SQL and SQL does not
understand sasi and ammu. You need to build up a string that uses the
variables containing the values you want to insert ie
Dim sqlstr as string
Dim sasi, ammu
sasi = 1234
ammu = 5678
sqlstr = "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
VALUES ("+str(sasi)+","+str(ammu)+")"
rs.Open sqlstr, conn
If you run this and check the value of sqlstr before rs.open it should
read;
"insert webleads.admin.DiagActivation (MachineClientID,cftoken)
VALUES (1234,5678)"
I trust this helps
Steve
-----Original Message-----
From: Sasi Vellolil [mailto:sasiv@a...]
Sent: Sunday, 1 December 2002 1:18 PM
To: ActiveX_Data_Objects
Subject: [activex_data_objects] RE: ASP and remote SQL database update
/insert
Steve,
Thank you so much for your help.
I have one last question.
The follwing line works.
rs.Open "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
VALUES (1234,5678)",conn
But if I use:
Dim sasi, ammu
sasi = 1234
ammu = 5678
rs.Open "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
VALUES (sasi,ammu)",conn
I get the error:
"Microsoft OLE DB Provider for SQL Server (0x80040E14)
The name 'sasi' is not permitted in this context.
Only constants, expressions, or variables allowed here.
Column names are not permitted."
Any clue on what is going on?
Regards
Sasi
> -----Original Message-----
> From: Steve Wark [SMTP:stevewark@c...]
> Sent: Wednesday, November 20, 2002 2:07 PM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] RE: ASP and remote SQL database
> update /insert
>
> 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
> >
> > %>
> >
> >
> >
> >
>
>
>
Message #3 by Sasi Vellolil <sasiv@a...> on Sun, 1 Dec 2002 14:27:01 -0500
|
|
Steve,
Thanks again.
I almost got it.
sCID = "322197AD7CC226D411B534DCE56B383CB4"
sqlstr = "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
VALUES ("+Cstr(sCID)+")"
rs.Open sqlstr, conn
I still have the follwing error:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
Line 1: Incorrect syntax near 'ad7cc226d411b534dce56b383cb4'.
I found out that It doesn't like Hex characters in the string. When it finds
the first hex character 'A'
it is complaining. If I have sCID without hex characters it works. How to
deal with this?
Thanks
Sasi
> -----Original Message-----
> From: Steve Wark [SMTP:stevewark@c...]
> Sent: Sunday, December 01, 2002 2:05 AM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] RE: ASP and remote SQL database
> update /insert
>
> The whole insert command is a string ie
>
> "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> VALUES (sasi,ammu)"
>
> Therefore it is this string that is passed to SQL and SQL does not
> understand sasi and ammu. You need to build up a string that uses the
> variables containing the values you want to insert ie
>
> Dim sqlstr as string
> Dim sasi, ammu
> sasi = 1234
> ammu = 5678
>
> sqlstr = "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> VALUES ("+str(sasi)+","+str(ammu)+")"
> rs.Open sqlstr, conn
>
> If you run this and check the value of sqlstr before rs.open it should
> read;
>
> "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> VALUES (1234,5678)"
>
> I trust this helps
>
> Steve
>
> -----Original Message-----
> From: Sasi Vellolil [mailto:sasiv@a...]
> Sent: Sunday, 1 December 2002 1:18 PM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] RE: ASP and remote SQL database update
> /insert
>
> Steve,
>
> Thank you so much for your help.
> I have one last question.
>
> The follwing line works.
> rs.Open "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> VALUES (1234,5678)",conn
>
> But if I use:
>
> Dim sasi, ammu
> sasi = 1234
> ammu = 5678
>
> rs.Open "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> VALUES (sasi,ammu)",conn
>
> I get the error:
> "Microsoft OLE DB Provider for SQL Server (0x80040E14)
> The name 'sasi' is not permitted in this context.
> Only constants, expressions, or variables allowed here.
> Column names are not permitted."
>
> Any clue on what is going on?
>
> Regards
> Sasi
>
> > -----Original Message-----
> > From: Steve Wark [SMTP:stevewark@c...]
> > Sent: Wednesday, November 20, 2002 2:07 PM
> > To: ActiveX_Data_Objects
> > Subject: [activex_data_objects] RE: ASP and remote SQL database
> > update /insert
> >
> > 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
> > >
> > > %>
> > >
> > >
> > >
> > >
> >
> >
> >
>
>
>
Message #4 by "Steve Wark" <stevewark@c...> on Mon, 2 Dec 2002 07:35:28 +1100
|
|
How are you storing the data, if you are storing it as a string then you
need to ensure the SQL statement treats it like a string ie
Dim sqlstr as string
Dim abc as string
Dim def as double
abc="ABCDEFGH906430032 "
def=234.56
sqlstr = "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
VALUES ('"+abc+"',"+Cstr(def)+")"
rs.Open sqlstr, conn
Note the ' ' surrounding the value of abc to tell SQL that it is a
string value.
Steve
-----Original Message-----
From: Sasi Vellolil [mailto:sasiv@a...]
Sent: Monday, 2 December 2002 6:27 AM
To: ActiveX_Data_Objects
Subject: [activex_data_objects] RE: ASP and remote SQL database update
/insert
Steve,
Thanks again.
I almost got it.
sCID = "322197AD7CC226D411B534DCE56B383CB4"
sqlstr = "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
VALUES ("+Cstr(sCID)+")"
rs.Open sqlstr, conn
I still have the follwing error:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
Line 1: Incorrect syntax near 'ad7cc226d411b534dce56b383cb4'.
I found out that It doesn't like Hex characters in the string. When it
finds
the first hex character 'A'
it is complaining. If I have sCID without hex characters it works. How
to
deal with this?
Thanks
Sasi
> -----Original Message-----
> From: Steve Wark [SMTP:stevewark@c...]
> Sent: Sunday, December 01, 2002 2:05 AM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] RE: ASP and remote SQL database
> update /insert
>
> The whole insert command is a string ie
>
> "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> VALUES (sasi,ammu)"
>
> Therefore it is this string that is passed to SQL and SQL does not
> understand sasi and ammu. You need to build up a string that uses the
> variables containing the values you want to insert ie
>
> Dim sqlstr as string
> Dim sasi, ammu
> sasi = 1234
> ammu = 5678
>
> sqlstr = "insert webleads.admin.DiagActivation
(MachineClientID,cftoken)
> VALUES ("+str(sasi)+","+str(ammu)+")"
> rs.Open sqlstr, conn
>
> If you run this and check the value of sqlstr before rs.open it should
> read;
>
> "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> VALUES (1234,5678)"
>
> I trust this helps
>
> Steve
>
> -----Original Message-----
> From: Sasi Vellolil [mailto:sasiv@a...]
> Sent: Sunday, 1 December 2002 1:18 PM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] RE: ASP and remote SQL database update
> /insert
>
> Steve,
>
> Thank you so much for your help.
> I have one last question.
>
> The follwing line works.
> rs.Open "insert webleads.admin.DiagActivation
(MachineClientID,cftoken)
> VALUES (1234,5678)",conn
>
> But if I use:
>
> Dim sasi, ammu
> sasi = 1234
> ammu = 5678
>
> rs.Open "insert webleads.admin.DiagActivation
(MachineClientID,cftoken)
> VALUES (sasi,ammu)",conn
>
> I get the error:
> "Microsoft OLE DB Provider for SQL Server (0x80040E14)
> The name 'sasi' is not permitted in this context.
> Only constants, expressions, or variables allowed here.
> Column names are not permitted."
>
> Any clue on what is going on?
>
> Regards
> Sasi
>
> > -----Original Message-----
> > From: Steve Wark [SMTP:stevewark@c...]
> > Sent: Wednesday, November 20, 2002 2:07 PM
> > To: ActiveX_Data_Objects
> > Subject: [activex_data_objects] RE: ASP and remote SQL database
> > update /insert
> >
> > 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
> > >
> > > %>
> > >
> > >
> > >
> > >
> >
> >
> >
>
>
>
Message #5 by Sasi Vellolil <sasiv@a...> on Sun, 1 Dec 2002 15:53:23 -0500
|
|
Wow, that is great.
It worked.
Thanks a million
Regards
Sasi
> -----Original Message-----
> From: Steve Wark [SMTP:stevewark@c...]
> Sent: Sunday, December 01, 2002 3:35 PM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] RE: ASP and remote SQL database
> update /insert
>
> How are you storing the data, if you are storing it as a string then you
> need to ensure the SQL statement treats it like a string ie
>
> Dim sqlstr as string
> Dim abc as string
> Dim def as double
>
> abc="ABCDEFGH906430032 "
> def=234.56
>
> sqlstr = "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> VALUES ('"+abc+"',"+Cstr(def)+")"
> rs.Open sqlstr, conn
>
> Note the ' ' surrounding the value of abc to tell SQL that it is a
> string value.
>
> Steve
>
> -----Original Message-----
> From: Sasi Vellolil [mailto:sasiv@a...]
> Sent: Monday, 2 December 2002 6:27 AM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] RE: ASP and remote SQL database update
> /insert
>
> Steve,
>
> Thanks again.
> I almost got it.
>
>
> sCID = "322197AD7CC226D411B534DCE56B383CB4"
>
> sqlstr = "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> VALUES ("+Cstr(sCID)+")"
> rs.Open sqlstr, conn
>
> I still have the follwing error:
>
> Microsoft OLE DB Provider for SQL Server (0x80040E14)
> Line 1: Incorrect syntax near 'ad7cc226d411b534dce56b383cb4'.
>
> I found out that It doesn't like Hex characters in the string. When it
> finds
> the first hex character 'A'
> it is complaining. If I have sCID without hex characters it works. How
> to
> deal with this?
>
> Thanks
> Sasi
>
>
> > -----Original Message-----
> > From: Steve Wark [SMTP:stevewark@c...]
> > Sent: Sunday, December 01, 2002 2:05 AM
> > To: ActiveX_Data_Objects
> > Subject: [activex_data_objects] RE: ASP and remote SQL database
> > update /insert
> >
> > The whole insert command is a string ie
> >
> > "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> > VALUES (sasi,ammu)"
> >
> > Therefore it is this string that is passed to SQL and SQL does not
> > understand sasi and ammu. You need to build up a string that uses the
> > variables containing the values you want to insert ie
> >
> > Dim sqlstr as string
> > Dim sasi, ammu
> > sasi = 1234
> > ammu = 5678
> >
> > sqlstr = "insert webleads.admin.DiagActivation
> (MachineClientID,cftoken)
> > VALUES ("+str(sasi)+","+str(ammu)+")"
> > rs.Open sqlstr, conn
> >
> > If you run this and check the value of sqlstr before rs.open it should
> > read;
> >
> > "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> > VALUES (1234,5678)"
> >
> > I trust this helps
> >
> > Steve
> >
> > -----Original Message-----
> > From: Sasi Vellolil [mailto:sasiv@a...]
> > Sent: Sunday, 1 December 2002 1:18 PM
> > To: ActiveX_Data_Objects
> > Subject: [activex_data_objects] RE: ASP and remote SQL database update
> > /insert
> >
> > Steve,
> >
> > Thank you so much for your help.
> > I have one last question.
> >
> > The follwing line works.
> > rs.Open "insert webleads.admin.DiagActivation
> (MachineClientID,cftoken)
> > VALUES (1234,5678)",conn
> >
> > But if I use:
> >
> > Dim sasi, ammu
> > sasi = 1234
> > ammu = 5678
> >
> > rs.Open "insert webleads.admin.DiagActivation
> (MachineClientID,cftoken)
> > VALUES (sasi,ammu)",conn
> >
> > I get the error:
> > "Microsoft OLE DB Provider for SQL Server (0x80040E14)
> > The name 'sasi' is not permitted in this context.
> > Only constants, expressions, or variables allowed here.
> > Column names are not permitted."
> >
> > Any clue on what is going on?
> >
> > Regards
> > Sasi
> >
> > > -----Original Message-----
> > > From: Steve Wark [SMTP:stevewark@c...]
> > > Sent: Wednesday, November 20, 2002 2:07 PM
> > > To: ActiveX_Data_Objects
> > > Subject: [activex_data_objects] RE: ASP and remote SQL database
> > > update /insert
> > >
> > > 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
> > > >
> > > > %>
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
>
>
>
Message #6 by Sasi Vellolil <sasiv@a...> on Mon, 9 Dec 2002 22:28:20 -0500
|
|
Steve,
This is Sasi again.
This time with a different problem
How to set the MIME type for CAB files in IIS/ASP page?
I mean what is the type/subtype for CAB files.
When I use MIME type as application\octet-stream,
the cab file down loaded is getting corrupted.The size
of the file downloaded is correct.
I have no problem downloading exes.
I checked the microsoft sit for this info.
Their extensive table has no CAB type at all !!
Any clue on what can be done?
Many thanks in advance
Sasi
> -----Original Message-----
> From: Steve Wark [SMTP:stevewark@c...]
> Sent: Sunday, December 01, 2002 3:35 PM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] RE: ASP and remote SQL database
> update /insert
>
> How are you storing the data, if you are storing it as a string then you
> need to ensure the SQL statement treats it like a string ie
>
> Dim sqlstr as string
> Dim abc as string
> Dim def as double
>
> abc="ABCDEFGH906430032 "
> def=234.56
>
> sqlstr = "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> VALUES ('"+abc+"',"+Cstr(def)+")"
> rs.Open sqlstr, conn
>
> Note the ' ' surrounding the value of abc to tell SQL that it is a
> string value.
>
> Steve
>
> -----Original Message-----
> From: Sasi Vellolil [mailto:sasiv@a...]
> Sent: Monday, 2 December 2002 6:27 AM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] RE: ASP and remote SQL database update
> /insert
>
> Steve,
>
> Thanks again.
> I almost got it.
>
>
> sCID = "322197AD7CC226D411B534DCE56B383CB4"
>
> sqlstr = "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> VALUES ("+Cstr(sCID)+")"
> rs.Open sqlstr, conn
>
> I still have the follwing error:
>
> Microsoft OLE DB Provider for SQL Server (0x80040E14)
> Line 1: Incorrect syntax near 'ad7cc226d411b534dce56b383cb4'.
>
> I found out that It doesn't like Hex characters in the string. When it
> finds
> the first hex character 'A'
> it is complaining. If I have sCID without hex characters it works. How
> to
> deal with this?
>
> Thanks
> Sasi
>
>
> > -----Original Message-----
> > From: Steve Wark [SMTP:stevewark@c...]
> > Sent: Sunday, December 01, 2002 2:05 AM
> > To: ActiveX_Data_Objects
> > Subject: [activex_data_objects] RE: ASP and remote SQL database
> > update /insert
> >
> > The whole insert command is a string ie
> >
> > "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> > VALUES (sasi,ammu)"
> >
> > Therefore it is this string that is passed to SQL and SQL does not
> > understand sasi and ammu. You need to build up a string that uses the
> > variables containing the values you want to insert ie
> >
> > Dim sqlstr as string
> > Dim sasi, ammu
> > sasi = 1234
> > ammu = 5678
> >
> > sqlstr = "insert webleads.admin.DiagActivation
> (MachineClientID,cftoken)
> > VALUES ("+str(sasi)+","+str(ammu)+")"
> > rs.Open sqlstr, conn
> >
> > If you run this and check the value of sqlstr before rs.open it should
> > read;
> >
> > "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> > VALUES (1234,5678)"
> >
> > I trust this helps
> >
> > Steve
> >
> > -----Original Message-----
> > From: Sasi Vellolil [mailto:sasiv@a...]
> > Sent: Sunday, 1 December 2002 1:18 PM
> > To: ActiveX_Data_Objects
> > Subject: [activex_data_objects] RE: ASP and remote SQL database update
> > /insert
> >
> > Steve,
> >
> > Thank you so much for your help.
> > I have one last question.
> >
> > The follwing line works.
> > rs.Open "insert webleads.admin.DiagActivation
> (MachineClientID,cftoken)
> > VALUES (1234,5678)",conn
> >
> > But if I use:
> >
> > Dim sasi, ammu
> > sasi = 1234
> > ammu = 5678
> >
> > rs.Open "insert webleads.admin.DiagActivation
> (MachineClientID,cftoken)
> > VALUES (sasi,ammu)",conn
> >
> > I get the error:
> > "Microsoft OLE DB Provider for SQL Server (0x80040E14)
> > The name 'sasi' is not permitted in this context.
> > Only constants, expressions, or variables allowed here.
> > Column names are not permitted."
> >
> > Any clue on what is going on?
> >
> > Regards
> > Sasi
> >
> > > -----Original Message-----
> > > From: Steve Wark [SMTP:stevewark@c...]
> > > Sent: Wednesday, November 20, 2002 2:07 PM
> > > To: ActiveX_Data_Objects
> > > Subject: [activex_data_objects] RE: ASP and remote SQL database
> > > update /insert
> > >
> > > 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
> > > >
> > > > %>
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
>
>
>
Message #7 by "Steve Wark" <stevewark@c...> on Tue, 10 Dec 2002 14:33:37 +1100
|
|
Sasi,
Not my area of expertise I'm afraid.
Regards
Steve
-----Original Message-----
From: Sasi Vellolil [mailto:sasiv@a...]
Sent: Tuesday, 10 December 2002 2:28 PM
To: ActiveX_Data_Objects
Subject: [activex_data_objects] RE: ASP and remote SQL database update
/insert
Steve,
This is Sasi again.
This time with a different problem
How to set the MIME type for CAB files in IIS/ASP page?
I mean what is the type/subtype for CAB files.
When I use MIME type as application\octet-stream,
the cab file down loaded is getting corrupted.The size
of the file downloaded is correct.
I have no problem downloading exes.
I checked the microsoft sit for this info.
Their extensive table has no CAB type at all !!
Any clue on what can be done?
Many thanks in advance
Sasi
> -----Original Message-----
> From: Steve Wark [SMTP:stevewark@c...]
> Sent: Sunday, December 01, 2002 3:35 PM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] RE: ASP and remote SQL database
> update /insert
>
> How are you storing the data, if you are storing it as a string then
you
> need to ensure the SQL statement treats it like a string ie
>
> Dim sqlstr as string
> Dim abc as string
> Dim def as double
>
> abc="ABCDEFGH906430032 "
> def=234.56
>
> sqlstr = "insert webleads.admin.DiagActivation
(MachineClientID,cftoken)
> VALUES ('"+abc+"',"+Cstr(def)+")"
> rs.Open sqlstr, conn
>
> Note the ' ' surrounding the value of abc to tell SQL that it is a
> string value.
>
> Steve
>
> -----Original Message-----
> From: Sasi Vellolil [mailto:sasiv@a...]
> Sent: Monday, 2 December 2002 6:27 AM
> To: ActiveX_Data_Objects
> Subject: [activex_data_objects] RE: ASP and remote SQL database update
> /insert
>
> Steve,
>
> Thanks again.
> I almost got it.
>
>
> sCID = "322197AD7CC226D411B534DCE56B383CB4"
>
> sqlstr = "insert webleads.admin.DiagActivation
(MachineClientID,cftoken)
> VALUES ("+Cstr(sCID)+")"
> rs.Open sqlstr, conn
>
> I still have the follwing error:
>
> Microsoft OLE DB Provider for SQL Server (0x80040E14)
> Line 1: Incorrect syntax near 'ad7cc226d411b534dce56b383cb4'.
>
> I found out that It doesn't like Hex characters in the string. When it
> finds
> the first hex character 'A'
> it is complaining. If I have sCID without hex characters it works. How
> to
> deal with this?
>
> Thanks
> Sasi
>
>
> > -----Original Message-----
> > From: Steve Wark [SMTP:stevewark@c...]
> > Sent: Sunday, December 01, 2002 2:05 AM
> > To: ActiveX_Data_Objects
> > Subject: [activex_data_objects] RE: ASP and remote SQL database
> > update /insert
> >
> > The whole insert command is a string ie
> >
> > "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> > VALUES (sasi,ammu)"
> >
> > Therefore it is this string that is passed to SQL and SQL does not
> > understand sasi and ammu. You need to build up a string that uses
the
> > variables containing the values you want to insert ie
> >
> > Dim sqlstr as string
> > Dim sasi, ammu
> > sasi = 1234
> > ammu = 5678
> >
> > sqlstr = "insert webleads.admin.DiagActivation
> (MachineClientID,cftoken)
> > VALUES ("+str(sasi)+","+str(ammu)+")"
> > rs.Open sqlstr, conn
> >
> > If you run this and check the value of sqlstr before rs.open it
should
> > read;
> >
> > "insert webleads.admin.DiagActivation (MachineClientID,cftoken)
> > VALUES (1234,5678)"
> >
> > I trust this helps
> >
> > Steve
> >
> > -----Original Message-----
> > From: Sasi Vellolil [mailto:sasiv@a...]
> > Sent: Sunday, 1 December 2002 1:18 PM
> > To: ActiveX_Data_Objects
> > Subject: [activex_data_objects] RE: ASP and remote SQL database
update
> > /insert
> >
> > Steve,
> >
> > Thank you so much for your help.
> > I have one last question.
> >
> > The follwing line works.
> > rs.Open "insert webleads.admin.DiagActivation
> (MachineClientID,cftoken)
> > VALUES (1234,5678)",conn
> >
> > But if I use:
> >
> > Dim sasi, ammu
> > sasi = 1234
> > ammu = 5678
> >
> > rs.Open "insert webleads.admin.DiagActivation
> (MachineClientID,cftoken)
> > VALUES (sasi,ammu)",conn
> >
> > I get the error:
> > "Microsoft OLE DB Provider for SQL Server (0x80040E14)
> > The name 'sasi' is not permitted in this context.
> > Only constants, expressions, or variables allowed here.
> > Column names are not permitted."
> >
> > Any clue on what is going on?
> >
> > Regards
> > Sasi
> >
> > > -----Original Message-----
> > > From: Steve Wark [SMTP:stevewark@c...]
> > > Sent: Wednesday, November 20, 2002 2:07 PM
> > > To: ActiveX_Data_Objects
> > > Subject: [activex_data_objects] RE: ASP and remote SQL database
> > > update /insert
> > >
> > > 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
> > > >
> > > > %>
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
>
>
>
|
|
 |