Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Mar 2006
    Posts
    10
    Member #
    12706
    do any of you have the code to connect to a SQL database from ASP.NET

    i done it in ASP but the SET commands dotn work no more in .NET

    prob a easy question for some of u pros

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Taking from http://www.4guysfromrolla.com/webtech/072101-1.shtml

    Code:
    Dim myConnection as New SqlConnection(<i>ConnectionString</i>)

  4. #3
    Junior Member j1mb0jay's Avatar
    Join Date
    Aug 2006
    Posts
    7
    Member #
    13758
    //trys a connection to the SQL server if it fails it returns the exp
    private
    staticstring ConnectSystem()
    {
    string dataInstance = "XSYSTEM";
    string dataSource = "xscreen.quadratica.co.uk";
    if (dataInstance != string.Empty)
    dataSource +=
    "\\" + dataInstance;
    string connectionString = "user id=yourusername; pwd=yourpassword; Initial Catalog=XSystem; Data Source=" + dataSource + ";Packet Size=4096";
    systemConnection =
    newSqlConnection(connectionString);
    try
    {
    systemConnection.Open();
    returnstring.Empty;
    }
    catch (Exception ex)
    {
    return ex.ToString();
    }
    }


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:12 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com