using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
namespace ConsoleApp57
{
class Program
{
static void Main(string[] args)
{
string conne = "Data Source=JAGADEESH\\SQLEXPRESS;Initial Catalog=Jagadeesh;User id=sa;Password=************";
string qry = "create table Employee2(eno int primary key, firstname varchar(10),lastname varchar(20),age int,disg varchar(15),doj date,sal float) ";
using (SqlConnection conn = new SqlConnection(conne))
{
try
{
conn.Open();
SqlCommand cmd = new SqlCommand(qry, conn);
cmd.ExecuteNonQuery();
Console.WriteLine("table is created");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.ReadKey();
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
namespace ConsoleApp57
{
class Program
{
static void Main(string[] args)
{
string conne = "Data Source=JAGADEESH\\SQLEXPRESS;Initial Catalog=Jagadeesh;User id=sa;Password=************";
string qry = "create table Employee2(eno int primary key, firstname varchar(10),lastname varchar(20),age int,disg varchar(15),doj date,sal float) ";
using (SqlConnection conn = new SqlConnection(conne))
{
try
{
conn.Open();
SqlCommand cmd = new SqlCommand(qry, conn);
cmd.ExecuteNonQuery();
Console.WriteLine("table is created");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.ReadKey();
}
}
}
}
No comments:
Post a Comment