Simple ASP/SQL Problem

Results 1 to 3 of 3

Thread: Simple ASP/SQL Problem

  1. #1
    Ronnie Brown Guest

    Default Simple ASP/SQL Problem

    I am attempting to place results from a form into an SQL database that I have created. I&#039ve set up the DSN connection to the database but I&#039m not really sure where to go from here.<BR><BR>Thanks for any help.

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default RE: Simple ASP/SQL Problem

    If you have set up the DSN connection then you have to R&D the connection object and the syntax of the insert statement.<BR><BR>You MAY also wnat to R&D the recordset object,cursors,lock types

  3. #3
    Join Date
    Dec 1969

    Default RE: Simple ASP/SQL Problem

    The simplest way is to use ADO:<BR><BR>This is sample conn to get you going.<BR>&#039Establish your db connection. <BR>&#039I suggest you store this in an #include<BR>Set oConn = Server.CreateObject("ADODB.Connection")<BR>oConn.O pen "YourDSN"<BR><BR>Set RS = Server.CreateObject("ADODB.Recordset")<BR>RS.Open "TableName",oConn,adOpenKeyset,adLockOptimistic,ad CmdTable<BR>&#039Get your form data, continue for each form field in your form<BR>strFormData = CStr(Request.Form("txtFormData")<BR><BR>RS.AddNew &#039Used for new Recordset<BR>&#039Your fields <BR>RS("FieldName")= strFormData &#039 Continue for each field<BR>....<BR>RS.Update&#039When all the fields are set for new data<BR><BR>&#039Clean up<BR>RS.Close<BR>Set RS = nothing<BR>oConn.Close<BR>Set oConn = nothing<BR><BR>Hope this helps. <BR><BR>Scott Smith<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts