connection to SQL
how do i connect to the SQL server? this is the codes I have and no matter what I do, I still cannot connect..
SqlConnection sqlConnection;
sqlConnection = new SqlConnection();
sqlConnection.ConnectionString = "Data Source=YINGTING\SQLEXPRESS;Initial Catalog=SMS;Integrated Security=True";
sqlConnection.Open();
please advise!
Vijaya KadiyalaPosted Aug 1, 2008, 11:04 AM
Hi,
Check out the below link
http://msdn.microsoft.com/en-us/library/ms998300.aspx
Thanks -- Vj
http://dotnetvj.blogspot.com
Niradhip ChakrabortyPosted Jul 8, 2008, 4:03 PM
Check out the following two articles. It will help you out to understand the concept of sql server with
.net2.0
1.http://searchsoa.techtarget.com/expert/KnowledgebaseAnswer/0,289625,sid26_gci928116,00.html
2.http://asptutorials.net/SQL-Server/accessing-sql-server-2005-from-asp-net-2/
ChongoPosted Jul 8, 2008, 10:57 AM
"data source="+ip or name+";"+
"initial catalog="+databasename+";"+
"integrated security=SSPI;"+
"persist security info=False;"+
"workstation id="+ip or name+";"+
"packet size=4096");
try
{
SqlCon.Open();
}
catch (Exception e)
{
//do something here like a messagebox
}