In this post i will show how to create a table in sql server/Oracle data base using Ado.net program.For this i just placed a button on page and write code for button click event to done this process
//BtnCreate_Click event
{
OledbConnection con=new OledbConnection("user id=scott;password =tiger;provider =msdaora.1");
con.Open();
MessageBox.Show("Con is good");
String strcmd="Create table ctr(eno number,Ename varchar(20),sal number(5))";
OledbCommand cmd=New OledbCommand(strcmd,con);
Try
{
cmd.ExcuteNonQuery();
MessageBox.Show("Table is created");
}
Catch(OLEDB exception oe1)
{
MessageBox.Show(oe1.Message);
}
obs:The table ctr has been created in Oracle Database
No comments:
Post a Comment