Skip to main content

Posts

Showing posts with the label sqldataadapter

Example of code of c sharp with SQL Server connectivity

using System; using System.Data; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; using System.Drawing; namespace DatabaseExp { public partial class DatabaseExp : Form { SqlConnection conn; SqlDataAdapter adaptr; SqlCommand cmd; DataTable tbl; static int count = 0, current = 0; static int check = 0; public DatabaseExp() { InitializeComponent(); } private void DatabaseExp_Load(object sender, EventArgs e) { string connectionString = null; adaptr = new SqlDataAdapter(); tbl = new DataTable(); connectionString = "Data Source=127.0.0.1;Initial Catalog=Abdul;User ID=sa;Password=allah"; conn = new SqlConnection(connectionString); try { conn.Open(); MessageBox.Show("Connection Open !", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); //conn.Close(); } catch (Exception ex) { Message