David wrote:
Hi
I have written few line codes but puzzling me lot giving
errors...
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open "wedding"
Don't use a DSN. Use the native OLEDB provider for your database. See here
for an example: www.able-consulting.com/ado_conn.htm. Avoid the ODBC section
and find the examples for the OLEDB provider for whatever your database is
(and in the future, always tell us what database you are using when asking a
database-related question).
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select * from Group"
rs.open sql, Conn ' Gives error this statement
Set rs = Nothing
Conn.close
Set Conn = Nothing
Connection is established successfully and recordset is
also created without any problem
but when it executes rs.open line it gives me error
tht
"SYNTAX ERROR NEAR FROM CLAUSE"
I cant understand whats going on...
Please help me...
Thanx in advance...
David
"Group" is a reserved word. It is a keyword in all SQL languages that I know
of (think "Group By"). It is a bad idea to use a reserved word for a column
or table name. I stronly recommend that you change the name of this table to
a non-reserved word (such as "Groups"). If you cannot change the name of the
table for some reason, then you will need to surround it with brackets []
when using it in a query: Select ... From [Group]. See here for a list of
reserved words:
http://www.aspfaq.com/show.asp?id=2080
I also suggest you avoid using "select * " in production code. Always
explicitly list the fields you wish your query to retun, even if you wish it
to return all the fields in your table. This is simply good coding practice,
and can avoid performance problems.
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"