Monday, October 26, 2009
create table programmatically with 'n' number of column c#
public int CreateTable(string tabname1,string tabname2,string[] MyAtt)
{
try
{
MyAtt = tabname1;
MyProd = tabname2;
SB.Append("CREATE TABLE " + MyProd + " (");
SBB.Append("CREATE TABLE " + MyProd + "_QUERYLOG (");
for (int i = 0; i < MyAtt.Length; i++)
{
if (i == MyAtt.Length-1)
{
SB.Append(MyAtt[i] + " BIT,");
SBB.Append(MyAtt[i] + " BIT)");
}
else
{
SB.Append(MyAtt[i] + " BIT,");
SBB.Append(MyAtt[i] + " BIT,");
}
}
SB.Append("DESCRIPTION VARCHAR(500),NOTEPAD IMAGE,MAXIVISI INT,FILNAM VARCHAR(500))");
int I = DAL.CreateTab(SBB.ToString());
int y = DAL.CreateTab(SB.ToString());
return y;
}
catch
{
return 0;
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment