new to sql....can anybody help..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • meenu_susi
    New Member
    • Jun 2006
    • 47

    new to sql....can anybody help..

    i am new to sql ..

    i want to know the database connection coding in sql
    with asp..

    with regards
    meenu
  • dna5122
    New Member
    • Jul 2006
    • 12

    #2
    You want to know how to write a connection string for SQL Server to be used by an ASP page?

    Comment

    • sashi
      Recognized Expert Top Contributor
      • Jun 2006
      • 1749

      #3
      hi there,

      check out the below sample connection strings.. take care..

      Sample Database Connection Strings

      If you are planning on making a database call from the web the first thing you will need to do is plan on making a "Database Connection". Here are some sample database connection strings to help you get started.


      OLE DB Method for SQL
      Code:
      <%
      set cnn = server.createobject("ADODB.Connection")
      cnn.open "PROVIDER=SQLOLEDB;DATA SOURCE=sqlservername;UID=username;PWD=password;DATABASE=databasename "
      %>
      DSN Less connection for Access
      Code:
      <%
      set cnn = server.createobject("ADODB.Connection")
      cnn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\anydatabase.mdb"
      %>
      OLE DB Method for Access
      Code:
      <%
      set cnn = server.createobject("ADODB.Connection")
      cnn.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=c:\anydatabase.mdb"
      %>
      File DSN Connection Method for Access
      Code:
      <% set cnn = server.createobject("ADODB.Connection")
      cnn.open "FILEDSN=AccessDSN"
      %>

      Comment

      • meenu_susi
        New Member
        • Jun 2006
        • 47

        #4
        Originally posted by dna5122
        You want to know how to write a connection string for SQL Server to be used by an ASP page?

        yes..i wnat ot knw the connection

        Comment

        • BeepBeep
          New Member
          • Aug 2006
          • 3

          #5
          Originally posted by meenu_susi
          yes..i wnat ot knw the connection


          <?
          $alogin = "SQL User";
          $apass = "SQL Pass";
          $host= "IP Address, Usally 127.0.0.1";
          $db = 'DB Name';
          $msconnect=mssq l_connect("$hos t","$alogin","$ apass");
          $msdb=mssql_sel ect_db("$db",$m sconnect);
          ?>

          Comment

          Working...