locked
Is it possible to connect to SQL Server without SQLClient? C RRS feed

  • Question

  • Is it possible to connect to SQL Server without SQLClient? Could you please helpme?

    Many thanks in advance,

    Tuesday, July 10, 2012 2:11 AM

Answers

All replies

  • Is it possible to connect to SQL Server without SQLClient? Could you please helpme?

    Many thanks in advance,


    No, if u want to do a connection to a remote SQL db, you must use something like a "tunnel" to link the db to that file……So I suggest you using "SqlClient",of course u can also use ODBC connection, but all in all, you have to use something to connect to the SQL Server Thread,and SqlClient is specially designed for SQL,which seems better……

    下载MSDN桌面工具(Vista,Win7)
    我的博客园
    慈善点击,点击此处

    Tuesday, July 10, 2012 2:13 AM
  • Thanks

    So I can connect to SQL Server by using OLeDb Connection too?!


    • Edited by NewCoder61 Tuesday, July 10, 2012 2:22 AM
    Tuesday, July 10, 2012 2:22 AM
  • Thanks

    So I can connect to SQL Server by using OLeDb Connection too?!


    Not sure but I don't suggest u doing so……:(

    下载MSDN桌面工具(Vista,Win7)
    我的博客园
    慈善点击,点击此处

    Tuesday, July 10, 2012 2:24 AM
  • Hi,

    This is not just limitation for sql server but for any database you need to have a provider/client which is kind of adapter/bridge which will be used to connect to specific database.

    You can achieve this using oldedb but if you want to use advanced features of database then better use provider /client provided by database vendor. I believe there will be performance benefits too.


    Tuesday, July 10, 2012 8:42 AM
  • you can try to use System.Data.OleDb Namespace

    The following sample shows how to connect with DB

    http://www.dotnetfunda.com/interview/exam5273-how-do-you-connect-to-sql-server-database-without-using-sqlclient.aspx


    Thanks and Regards Selvam http://www15.brinkster.com/selvamselvam/

    Tuesday, July 10, 2012 8:51 AM
  • Hi,

    Or try rather to explain what you are trying to do rather than how you try to do it. For example you have a class factory if your goal is to be database agnostic. What is your issue ?


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".


    Tuesday, July 10, 2012 9:18 AM
  • you can try to use System.Data.OleDb Namespace

    The following sample shows how to connect with DB

    http://www.dotnetfunda.com/interview/exam5273-how-do-you-connect-to-sql-server-database-without-using-sqlclient.aspx


    Thanks and Regards Selvam http://www15.brinkster.com/selvamselvam/

    Thanks!

    I copy the code from the mentioned link here:

    <script runat="server">
    
    sub Page_Load
    dim dbconn
    dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
    data source=" & server.mappath("northwind.mdb"))
    dbconn.Open()
    end sub
    </script>

    But this code is for VB and I do not understand. also is the following line our connection string? Thanks 

    "Provider=Microsoft.Jet.OLEDB.4.0;
    data source=" & server.mappath("northwind.mdb")

    Tuesday, July 10, 2012 4:58 PM
  • Yes, this is the connection string for a "Microsoft Access" file based database.

    "SQL Server" is the name of the Microsoft SQL database product hence perhaps the confusion ? Do you mean you want to connect to a SQL based database which is not SQL Server ?

    Depending on your database requirements, you also have "SQL Server Compact Edition" that is installed as a single DLL  (assuming the issue with SQL Server Express is the setup phase).

    For some C# code try http://msdn.microsoft.com/en-us/library/aa288452(v=vs.71).aspx

    You still may want to explain what is your exact issue (you do want to connect to a Microsoft Access database from a web application ? I'm not even sure if you choose a web app sample on purpose ?? as you don't have explained yet what you are trying to do).


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".

    Tuesday, July 10, 2012 5:45 PM