to fetch the table name
-
I have a table which name is login & contain 3 columns. Such as: Name,password & code. In code column contains the table name. eg: table1,table2 so on. And I also create the table of same name as mentioned in code column which is mentioned above. My requirement is that I insert the value in table1 or table2. but in insert query I want to put the table name from the code column. I use following two methods but it didn’t work::
string code = " select code from login where user_name= name";
da = new SqlDataAdapter(code, con);
string s = da.Fill(ds, "c");string time = " insert into '"+s+"' values (getdate(),getdate())";
da = new SqlDataAdapter(time, con);
da.Fill(ds, "b");------------OR-------------
string code = " select code from login where user_name = name'";
string time = " insert into '"+s+"' values (getdate(),getdate())";
da = new SqlDataAdapter(time, con);
da.Fill(ds, "b");thanks in advance