Lunarpages Web Hosting Forum

Author Topic: Simple ASP -> MS-SQL Connection Script Needed ASAP  (Read 1786 times)

Offline Relaxasaurus

  • Trekkie
  • **
  • Posts: 19
Simple ASP -> MS-SQL Connection Script Needed ASAP
« on: February 19, 2007, 06:37:06 AM »
I keep getting 500 Internet Server Error, here is the script I'm using in the header:

Code: [Select]
Dim dbc
Dim strConn

strConn = Session("connect")
StrConn="Provider=sqloledb;Data Source=209.200.235.3;Database=db_name;User ID=user_id;Password=user_pw;"

Set dbc = Server.CreateObject("ADODB.Connection")
dbc.open strConn


DIM SQL, objRS
SQL = "SELECT * FROM table_name WHERE coulmn_name='Yes'"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open SQL, dbc


And here is what I have between the <body> tags:

Code: [Select]
Title of the CURRENT article: <%= objRS("title") %>

The Database login/pw/& db_name are correct and verified with Lunarpages Tech Support, but they couldn't help me with the connection script.

Thanks for any help!
« Last Edit: February 19, 2007, 06:51:30 AM by Relaxasaurus »

Offline Relaxasaurus

  • Trekkie
  • **
  • Posts: 19
Re: Simple ASP -> MS-SQL Connection Script Needed ASAP
« Reply #1 on: February 19, 2007, 06:45:32 AM »
blehhh I was wrestling with this problem for 3 straight days then as soon as I post about it I find the answer myself.


SQL = "SELECT * FROM table_name WHERE [table_name].[column_name]='Yes'"


I remember seeing SQL servers be finnicky about SQL statements before so I tried that and voila, it works!
« Last Edit: February 19, 2007, 06:51:04 AM by Relaxasaurus »