Connectivity of ASP.NET 2.0 with SQL server 2000

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?VHJpdmVkaSBDaGlua2Fs?=

    #1

    Connectivity of ASP.NET 2.0 with SQL server 2000

    Hello Friends,

    I am learning ASP.NET 2.0 myself. So, I have problem for connention of
    ASP.NET 2.0 with SQL server 2000 that I cant understand that So, which thing
    helpful for me about this connetion Or which thing I have to learn for that
    please tell me.

    Thanks.
  • Mark Rae [MVP]

    #2
    Re: Connectivity of ASP.NET 2.0 with SQL server 2000

    "Trivedi Chinkal" <Trivedi Chinkal@discuss ions.microsoft. comwrote in
    message news:3603EBBD-409B-454A-9CA7-21D6DBC6B179@mi crosoft.com...
    I am learning ASP.NET 2.0 myself. So, I have problem for connention of
    ASP.NET 2.0 with SQL server 2000 that I cant understand that
    Firstly, you should be aware that mainstream support for SQL Server 2000
    ended several months ago:


    I would strongly suggest that you upgrade to the latest version.
    So, which thing helpful for me about this connetion
    Or which thing I have to learn for that please tell me.
    It's probably simplest if you say what problems you are having, and show us
    your code...


    --
    Mark Rae
    ASP.NET MVP


    Comment

    • Cowboy \(Gregory A. Beamer\)

      #3
      Re: Connectivity of ASP.NET 2.0 with SQL server 2000

      Here is a simple pattern, using a dataset. I am including the entire class,
      to make things easier. This is a bit of a strange pattern in some ways, but
      it matches the other methodology of other classes (using table adapters), so
      it will make things easier for the Junior devs who might take over the code.

      The table mappings here are a bit heavy, but the basic model should work for
      you if you use strongly typed datasets. I have more info on why this one is
      patterned this way at:
      http://gregorybeamer.s paces.live.com/blog/cns!B036196EAF9 B34A8!974.entry

      using System;
      using System.Collecti ons.Generic;
      using System.Data;
      using System.Data.Sql Client;
      using System.Text;
      using Microtrak.UnitW arehouse.Data.D ataSets;

      namespace Microtrak.UnitW arehouse.Data.R epositories
      {
      public class UnitInfoReposit ory
      {
      private string _connectionStri ng;

      public UnitInfoReposit ory(string connectionStrin g)
      {
      _connectionStri ng = connectionStrin g;
      }

      public UnitInfoDS GetUnitInformat ionByImei(strin g imei)
      {
      var ds = new UnitInfoDS();

      var connection = new SqlConnection(_ connectionStrin g);
      var command = new SqlCommand("Fil lUnitInfoDataSe tByIMEI",
      connection);
      command.Command Type = CommandType.Sto redProcedure;
      command.Paramet ers.AddWithValu e("@IMEI", imei);

      //Set table mappings
      var da = new SqlDataAdapter( command);
      da.TableMapping s.Add("Table", "Unit");
      da.TableMapping s.Add("Table1", "UnitModelType" );
      da.TableMapping s.Add("Table2", "UnitManufactur erType");
      da.TableMapping s.Add("Table3", "Product");
      da.TableMapping s.Add("Table4", "ProductLin e");
      da.TableMapping s.Add("Table5", "Project");
      da.TableMapping s.Add("Table6", "PID");
      da.TableMapping s.Add("Table7", "FirmwareVersio nType");
      da.TableMapping s.Add("Table8", "APN");
      da.TableMapping s.Add("Table9", "SIM");
      da.TableMapping s.Add("Table10" , "ShippingCarton ");
      da.TableMapping s.Add("Table11" , "Script");
      da.TableMapping s.Add("Table12" , "FriendIpAddres sGroup");
      da.TableMapping s.Add("Table13" , "FriendIpAddres s");

      try
      {
      connection.Open ();
      da.Fill(ds);
      }
      catch (Exception)
      {

      throw;
      }



      return ds;
      }

      }
      }


      --
      Gregory A. Beamer
      MVP, MCP: +I, SE, SD, DBA

      Subscribe to my blog


      or just read it:


      *************** *************** **************
      | Think outside the box! |
      *************** *************** **************
      "Trivedi Chinkal" <Trivedi Chinkal@discuss ions.microsoft. comwrote in
      message news:3603EBBD-409B-454A-9CA7-21D6DBC6B179@mi crosoft.com...
      Hello Friends,
      >
      I am learning ASP.NET 2.0 myself. So, I have problem for connention of
      ASP.NET 2.0 with SQL server 2000 that I cant understand that So, which
      thing
      helpful for me about this connetion Or which thing I have to learn for
      that
      please tell me.
      >
      Thanks.

      Comment

      Working...