Results 1 to 13 of 13

Thread: Please need help a simple question

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    7

    Please need help a simple question

    I wana know how i can acess a Database from SQL of my friend's server, what the code i use...please write below.

    And if i wanna do ''whos is online in the server'' in a homepage how i can do it....please write the code below especifing.

    PLEASE I need it , if you do..i'll thank you!

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    7
    thanks...if somebody wants to explain better, i will thank

  4. #4
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by Crawlerz
    thanks...if somebody wants to explain better, i will thank
    You need to explain yourself better and be more specific, your question is slightly vauge.

    Firstly if you wanna connect to a remote SQL Server you do it so by using the IP and the port No of the server. Look up the connection string for remote connection in http://www.able-consulting.com/ADO_Conn.htm.

    As for who is online, there is many wasy you can do it, If you are using ASP then you can do so using Application variable and increment/decrement a Counter variable when a new session is started/ended. Search on 4GuysFromRolla.com you should find many example.

    Hope this helps.

    Danial
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    7

    help

    HELP PLEASE - im only trying to acess a simple SQL server...nut its not simple for me. need help please.

    Help im getting this error:

    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    Compilation Error
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30037: Character is not valid.

    Source Error:



    Line 2: <script runat="server">
    Line 3:
    Line 4: <%
    Line 5: Set Conn = Server.CreateObject("ADODB.Connection")
    Line 6: Conn.open "DSN=felipeiron.no-ip.com;UID=mine;PWD=mine;DATABASE=MEMB_STAT"

    -------------------------------------------------------------------

    and my code is:

    <%
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.open "DSN=felipeiron.no-ip.com;UID=mine;PWD=mine;DATABASE=MEMB_STAT"
    strSQL = "SELECT * memb stats"
    conn.Open strConexao
    rs.Open strSQL, conn
    Do While Not rs.EOF
    Response.Write rs.Fields("memb stats").Value & "<br>"
    Loop
    %>
    ----------------------------------------------------------

    and i dunno what can i put in ''DATABASE='' in the code
    and ''SELECT * '' too

  6. #6
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965
    Conn.open "DSN=felipeiron.no-ip.com;UID=mine;PWD=mine;DATABASE=MEMB_STAT"
    strSQL = "SELECT * memb stats"
    conn.Open strConexao

    Why are you opening 2 Connections? This maybe your problem. Otherwise your code looks ok.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  7. #7

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    7

    help

    ok I erased that ...but the error persist
    -----------------------------------------------------
    now the code is:

    <%
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.open "DSN=felipeiron.no-ip.com;UID=mine;PWD=mine;DATABASE=MEMB_STAT"
    strSQL = "SELECT * memb stats"
    rs.Open strSQL, conn
    Do While Not rs.EOF
    Response.Write rs.Fields("memb stats").Value & "<br>"
    Loop
    %>

  8. #8
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965
    Do you have a DSN setup on the machine that you are executing this code? If so, what happens when you click on the test connection button in the DSN?

    Sent from my Treo 600
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  9. #9

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    7
    May I explain it to you...Im trying to acess a SQL server of my friend, Im only the ''webmaster'' that want to acess it for him from a home page.

    Im doing a benefit for him.
    I have the DSN, the name of the Table and SQL server, so what code i have to use, what type of code? ASP? if its ASP i using it.

    HELP ME ANYONE please.

  10. #10
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965
    Have you tested the dsn? I am sure that you probably know this already but the you have to define the dsn on your machine. If that works then I don't know what problem is
    Last edited by Mark Gambo; Aug 22nd, 2004 at 06:27 PM.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  11. #11

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    7
    i think DSN is the IP of the Server, isnt it?

  12. #12
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965
    i think DSN is the IP of the Server, isnt it?
    No the Data Source Name or DSN for short provides connectivity to a database through an ODBC driver. The DSN contains database name, directory, database driver, UserID, password, and other information. Once you create a DSN for a particular database, you can use the DSN in an application to call information from the database.
    There are three types of DSNs:

    (1) System DSN -- can be used by anyone who has access to the machine. DSN info is stored in the registry.
    (2) User DSN -- created for a specific user. Also stored in the registry.
    (3) File DSN -- DSN info is stored in a text file with .DSN extension.

    DSN is often used by Active Server Pages (ASP) and Visual Basic programs when a query to a database is necessary to retrieve information.

    There is also what is known as a "DSN-less connection." Instead of using a DSN to connect to a database, the developer specifies the necessary information right in the application. With a DSN-less connection the developer is free to use connection standards other than ODBC, such as OLE DB.


    Check out this links:

    Setting Up a System DSN
    Creating a Local DSN
    Setting up a System DSN
    How to create a System DSN for Microsoft SQL Server[QUOTE]
    Last edited by Mark Gambo; Aug 22nd, 2004 at 06:28 PM.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  13. #13

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    7
    hey, i did a conection to a sql server below, but i have to put it on a .asp page?? or html?? or .jsp??
    when i put it there, on the page, in my case the member satus will open??? the code below is correct???
    -----------------------------------
    <%
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.open "DSN=felipeiron.no-ip.com;UID=mine;PWD=mine;DATABASE=MEMB_STAT"
    strSQL = "SELECT * memb stats"
    rs.Open strSQL, conn
    Do While Not rs.EOF
    Response.Write rs.Fields("memb stats").Value & "<br>"
    Loop
    %>

Posting Permissions

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



Click Here to Expand Forum to Full Width