-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbConnection.cs
43 lines (37 loc) · 1.03 KB
/
dbConnection.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Data.Common;
namespace login1
{
public class dbConnection
{
public dbConnection()
{
}
public SqlConnection connect()
{
SqlConnection cn = new SqlConnection();
cn.ConnectionString = "Trusted_Connection=false;Initial Catalog=ramani; Data Source=(local);persist security info=true;User id=cerner;password=manipal@321";
try{
cn.Open();
//MessageBox.Show("COonection established");
}
catch(Exception e)
{
MessageBox.Show("Connection not working",e.Message);
}
return cn;
}
public void disconnect(SqlConnection cn)
{
cn.Close();
MessageBox.Show("connection close");
}
}
}