You can connect to sql server using the code.
1. First create connection object and give it a connectionstring
System.Data.SqlClient.SqlConnection con;
con.ConnectionString = "Data Source=yourservername;Initial
Catalog=yourdbname;User ID=sa";
con.Open();
2. Now you can use retrieve data from database using sqldataReader object or
SQLDataAdapter Object through SQLCOmmand like
System.Data.SqlClient.SqlCommand sql;
sql.CommandText = "SELECT * FROM emp";
sql.Connection = con;
string empname;
System.Data.SqlClient.SqlDataReader rd;
rd = sql.ExecuteReader;
while (rd.Read=true)
{
empname = rd("columnname");
}
rd.Close;
"Sherwood" wrote:
Quote:
Greetings,
>
I am using Visual C#.NET 2005 (Express Edtion) and want to retrieve data
from a SQL Server 2005 (Express Edition) database. However, I see that there
is no SQL Data Adapter control nor a SQL Connection control. What controls
should I use instead?
>
Thanks in advance!