#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    30
    Rep Power
    12

    What's wrong on this code (connecting to MSSQL)


    Hi!

    Can somebody guide me on connecting to MSSQL using asp. Pardon me, this is my first time.

    Here is the code:

    dim rs_mssql1.pinoywebhosting.com

    dim conn

    Set conn = Server.CreateObject("ADODB.Connection")

    set rs_mssql1.pinoywebhosting.com = server.createobject("adodb.recordset")

    'you don't need provider name for odbc datasource name

    'do not put parethesis around datasource name

    conn.open "HostISC"

    'conn.Open "Provider=SQLOLEDB; Data Source = (ISC); Initial Catalog =

    pubs;

    'User Id = sa; Password="


    Set dbCommand = Server.CreateObject("ADODB.Command")

    Set dbCommand.ActiveConnection = dbConnection


    dbCommand.CommandText = "Log_In"

    dbCommand.CommandType = adCmdStoredProc


    Set prm = dbCommand.CreateParameter("@UserID", adVarChar, adParamInput, 8, trim(Request.Form ("txtName")))

    dbCommand.Parameters.Append prm

    Set prm = dbCommand.CreateParameter("@Password", adVarChar, adParamInput, 8, trim(Request.Form ("txtPassword")))

    dbCommand.Parameters.Append prm



    Set rsComplainant =Server.CreateObject("ODBC.Recordset")

    set rsComplainant=dbCommand.execute


    If conn.errors.count = 0 Then

    Response.write "Connected OK"

    End If
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    NJ
    Posts
    428
    Rep Power
    17

IMN logo majestic logo threadwatch logo seochat tools logo