PDA

View Full Version : سوال: Sqlconnection



Danial1369
سه شنبه 04 اسفند 1388, 20:51 عصر
سلام وقتی میخوام به SQL وصل بشم با errorمواجه میشم,باید چکار کنم.
error=instance failure

r00tkit
سه شنبه 04 اسفند 1388, 22:13 عصر
سلام راحت ترین راه وصل شدن:




SqlConnection ee = new SqlConnection("Data Source=localhost ;database=mydatabase;Integrated Security=True");
ee.Open();
MessageBox.Show(ee.State.ToString());


mydatabase=اسم database شماست

r00tkit
سه شنبه 04 اسفند 1388, 22:36 عصر
حوصلم نشد ترجمه کنم هر جاشو نگرفتی بگو توضیح بدم



SQL Server Connection Strings

SQL Server Managed Provider connection strings contain a variety of elements, but only a handful are used in most development. (A complete reference of the supported settings can be found at Microsoft Developer Network [MSDN]) The most common settings are


Server: The name or address of the SQL Server machine (for example, 192.168.0.1, myserver.mydomain.com, or localhost

Integrated Security: A Boolean flag that indicates whether the SQL Server will be using NT Authentication or Username/Password validation. By setting Integrated Security to true, SQL Server will use the current NT Security descriptor for authentication to the database. The default is false

User ID: The user ID that should be used to authenticate with the database server (when Integrated Security is turned off

Password: The password that should be used to authenticate with the database server (when Integrated Security is turned off

Connection Timeout: The number of seconds for which the connection should attempt to connect before failing. The default is 15 seconds