Click here to Skip to main content
16,014,734 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Need to connect my project with SQL server
Posted
Comments
nagendrathecoder 28-Jul-10 7:14am    
Read a book or search google first, then visit that link.

Refer this[^] site.



HTH
 
Share this answer
 
To Connect to a database u need ConnectionString it define the data source and database name

use the following line of code

Dim ConString as string

ConString="Server=Your PC Name;Database=dbname;Integrated Security=SSPI"
dim cnn as new sqlconnection(ConString)
cnn.open()
do something
cnn.close()
 
Share this answer
 
what sort of project do you have?

Are you new to .net? Is it a .net project?

You should consider using the data application block in the enterprise library for database connectivity .... it uses patterns in the background to do everything ....

You should be able to find examples easily enough on the web, or on sites like this :)
 
Share this answer
 
Hi


Using System.Data.SqlClient;

sqlconnection con = new sqlconnection();
sqldataadapter da = new sqladapter("SQL COMMAND" , con);
dataset ds = new dataset();
da.fill(ds , "table");
grdiview1.datasource = ds.Tables[0].rows[0].Tostring();
grdiview1.DataBind();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900