none
How to change the data connector and related item from MsACCESS mdb to SQL2008R2 EXPRESS RRS feed

  • Question

  • Hi,

    I have a old .ASP page which included a ABC.INC file with the below contents which used to query from a MCACCESS database and now I have migrated the .mdb to a SQL2008R2 Express database.

    Could you please advise on using which provider / which commander / DataSet is still valid ??

    Please kindly advise

    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.OleDb" %>

    <script Language="VB" runat="server">


      '·s¼W¡B§R°£¡B­×§ï¸ê®Æªº°Æµ{¦¡
      Sub Edit_Data(ByVal DBName As String, ByVal SQLcmd As String)
          Dim conn_str As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DBName)    
          Dim conn As OleDbConnection = New OleDbConnection(conn_str)
          conn.Open()
          Dim cmd As OleDbCommand = New OleDbCommand(SQLcmd, conn)
          cmd.ExecuteNonQuery()
          conn.Close()
      End Sub
     
      'Àˬd¦r¦êªº¨ç¼Æ
      Function Check_Str(ByVal str As String) As String
          Check_Str = Replace(str, "'" , "''")
      End Function 
     
      '«Ø¥ßDataReaderª«¥óªº¨ç¼Æ
      Function Create_Rd(ByVal DBName As String, ByVal SQLcmd As String) As OleDbDataReader
          Dim conn_str As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DBName)
          Dim conn As OleDbConnection = New OleDbConnection(conn_str)
          conn.Open()
          Dim cmd As OleDbCommand = New OleDbCommand (SQLcmd, conn)
          Dim rd As OleDbDataReader
          Create_Rd = cmd.ExecuteReader()
      End Function
     
      '«Ø¥ßDataTableª«¥óªº¨ç¼Æ
      Function Create_Table(ByVal DBName As String, ByVal SQLcmd As String, ByVal TabName As String) As DataTable
          'Dim conn_str As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DBName)
          Dim conn_str As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:\.mdb" & ";User Id=admin;Password=;"
          Dim conn As OleDbConnection = New OleDbConnection(conn_str)
          conn.Open()
          Dim myDataSet As DataSet = new DataSet()
          Dim myAdapter As OleDbDataAdapter
          myAdapter = New OleDbDataAdapter(SQLcmd, conn)
          myAdapter.Fill(myDataSet, TabName)
          Create_Table = myDataSet.Tables(TabName)
      End Function

      Function Create_Table1(ByVal DBName As String, ByVal SQLcmd As String, ByVal TabName As String) As DataTable
          'Dim conn_str As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DBName)
          Dim conn_str As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:\List.mdb" & ";User Id=admin;Password=;"
          Dim conn As OleDbConnection = New OleDbConnection(conn_str)
          conn.Open()
          Dim myDataSet As DataSet = new DataSet()
          Dim myAdapter As OleDbDataAdapter
          myAdapter = New OleDbDataAdapter(SQLcmd, conn)
          myAdapter.Fill(myDataSet, TabName)
          Create_Table1 = myDataSet.Tables(TabName)
      End Function
     
    </script>


    • Edited by kkcci88888 Thursday, August 29, 2013 2:24 AM
    • Moved by Carl Cai Friday, August 30, 2013 3:39 AM get better support
    Thursday, August 29, 2013 2:23 AM

Answers

  • There is an OLEDB provider for MS SQL Server. It will be discontinued with SQL Server 2012. You can use Bing or Google on how to use the Oledb for SQL server.
    Thursday, August 29, 2013 3:03 AM

All replies

  • There is an OLEDB provider for MS SQL Server. It will be discontinued with SQL Server 2012. You can use Bing or Google on how to use the Oledb for SQL server.
    Thursday, August 29, 2013 3:03 AM
  • Hi,

    I have moved this thread to Data Platform forum for better response.

    Best regards,


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, August 30, 2013 4:53 AM