Hi friend, i am trying to learn ASP but i face problem to connect ASP wtih
SQL Server.
Anyone help me.

Sushil ..

Hi Sushil,

use this code to add data in a table using asp and sql server

dim cn, rs
set cn=server.CreateObject("adodb.connection")
cn.Open "Provider=sqloledb;SERVER=localhost;DATABASE=your_database_neme;UID=your_database_login_id;PWD=your_database_login_password;"
set rs=server.CreateObject("adodb.recordset")
rs.open "Select * from table_name",cn,adOpenKeyset,adLockOptimistic
rs(0) = "here_is_your_value_for_first_field"
rs(1) = "here_is_your_value_for_second_field"

Connect to SQL server with ASP needs ADODB connection.
This connection can extract data from database and insert data into database.
What problem do you face?

Hi Sushil,

connect ASP wtih SQL Server.

dim con, Rs
set con=server.CreateObject("adodb.connection")
con.Open "Provider=sqloledb;SERVER=localhost;DATABASE=database_name;UID=login_ID ;PWD=login_password;"
set Rs=server.CreateObject("adodb.recordset")


i donot know about how to set drivers. plz tell me the name of drivers of sql

commented: fdsggsdg +0

well i tried the above code to connect the SQL table, but it is always giving me an error and the webpage can not be displayed... any help please.. (btw i'm using SQL server 2008)

please guys help me i want code to connect my asp code to the MSSQL SERVER
Please help me

Have you tried doing it through the designer hence creating the connection for you automatically

It's doubtful. They evidently cannot even follow the most basic of instructions, search on their own for information that is available all over the net, or post detailed information about the problems they are experiencing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.