none
SQL server and visual Studio 2010 RRS feed

  • Question

  • Hi all,

        1.  I am developing a front end software designed in wpf which is supposed run on many computers and the database in one dedicated PC. the Database I am planning to use SQL server 2008 at the server end .

        2.  earlier I was doing the same thing using the database made in MS Access 2007. it was self explanatory and I used OLEDB objects in code ie C#. the connection string for example looked like this connectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:/softwarestudy/Book.accdb"; in the case of SQL Server what will be the equivalent connection string that I should use in C# code . moreover as the database(database file) is residing in another computer which is connected through LAN what will beDataSource ? ie how the connection string look like in this case.

      3.I am using Visual C# 2010 for designing front end . 

      4.in SQL Server 2008 once I create a database using SQL server management studio where the file will be created. what will be the extension  as in the para 2 "Book.accdb".

      5. how I can give the information of such a Database/Table ie created in sql server using SQL server management studio to the connection string in the C# code .

        hope my queries are lucid and clear . I request any help

    thanks in advance 

    Regards

    Md.Iqbal


    itismeiqbal

    Wednesday, May 23, 2012 2:27 PM

Answers

  • Hey Iqbal1980,

    you can use soo many options like Paul P Clement 4 said

    • If you want to use the SqlClient Driver then you have to use th namespace System.Data.SqlClient and give the connection string accordingly something like this server=yourserverinstance;Database=yourdatabasename;uid=$a;pwd=$KEIDMEUW;
    1. And to retrive data from the data table there are soo many styles like SQl Queries, Stored Procedures in database engine ,SqlCommands,SqlDataAdapters My favorite is use of sql stored procedure where you write the SQL SELECT commands in database engine, and get the result in dataset with the help of the SqlDataAdapter
    • If you want to use Oledb you have to use the System.Data.oledb
    1. Do the same steps

    and before doing my steps go through these

    There are a number of possibilities depending upon the type of security implemented and where SQL Server is installed and which ADO.NET provider (SqlClient?, OleDb?) you are using.

    Keep in mind that you are now working with a server type database as opposed to a file based database. The location of the SQL Server database file will not be relevant to your app unless the database is being deployed to other systems.

    Paul ~~~~ Microsoft MVP (Visual Basic)



    $Kracker


    • Edited by SKracker Friday, May 25, 2012 6:37 AM spelling mistake
    • Marked as answer by iqbal1980 Saturday, May 26, 2012 12:27 PM
    Friday, May 25, 2012 6:35 AM

All replies

  • There are a number of possibilities depending upon the type of security implemented and where SQL Server is installed and which ADO.NET provider (SqlClient?, OleDb?) you are using. I would see the below link for examples:

    http://www.connectionstrings.com/sql-server-2008

    Keep in mind that you are now working with a server type database as opposed to a file based database. In your scenario the connection will be to SQL Server and in the connection string you can define which database to connect to. The location of the SQL Server database file will not be relevant to your app unless the database is being deployed to other systems.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    • Proposed as answer by SKracker Friday, May 25, 2012 6:18 AM
    Wednesday, May 23, 2012 5:50 PM
  • Hey Iqbal1980,

    you can use soo many options like Paul P Clement 4 said

    • If you want to use the SqlClient Driver then you have to use th namespace System.Data.SqlClient and give the connection string accordingly something like this server=yourserverinstance;Database=yourdatabasename;uid=$a;pwd=$KEIDMEUW;
    1. And to retrive data from the data table there are soo many styles like SQl Queries, Stored Procedures in database engine ,SqlCommands,SqlDataAdapters My favorite is use of sql stored procedure where you write the SQL SELECT commands in database engine, and get the result in dataset with the help of the SqlDataAdapter
    • If you want to use Oledb you have to use the System.Data.oledb
    1. Do the same steps

    and before doing my steps go through these

    There are a number of possibilities depending upon the type of security implemented and where SQL Server is installed and which ADO.NET provider (SqlClient?, OleDb?) you are using.

    Keep in mind that you are now working with a server type database as opposed to a file based database. The location of the SQL Server database file will not be relevant to your app unless the database is being deployed to other systems.

    Paul ~~~~ Microsoft MVP (Visual Basic)



    $Kracker


    • Edited by SKracker Friday, May 25, 2012 6:37 AM spelling mistake
    • Marked as answer by iqbal1980 Saturday, May 26, 2012 12:27 PM
    Friday, May 25, 2012 6:35 AM