Wednesday, 16 July 2014

To create connection string for database connectivity

Creating connection string for database connectivity:

Control panel -> Administrative tools -> Data sources ODBC -> Add button  -> select sql server  -> type the Name and server and click on NEXT -> click on NEXT -> select the database from the list and click on NEXT  -> click on FINISH -> click on Test Data source -> OK -> OK.


 Now steps in Visual studio

1. From toolbox select Data -> SqlDataSource


















2. Select the  symbol as shown in fig.  click on configure Data source




3. New connection -> select the name of database and server name and click OK  ->  NEXT ->  NEXT  > select the database name and check on *   -> next   test query -> FINISH





























This will create database connectivity for transferring data from asp to database and vise verso

In the web.config file, you will get the connectionstring added automatically.

<configuration>
    <connectionStrings>
        <add name="studConnectionString" connectionString="Data Source=DESAI-PC\SQLEXPRESS;Initial Catalog=stud;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>


copy the connection string for use at the time of coding.





No comments:

Post a Comment

POST YOUR COMMENTS AND FAQ........