Durga Velusamy

Durga Velusamy

  • NA
  • 318
  • 115.2k

how to convert list to array or how to do this below code

Jul 10 2015 6:35 AM
public class Emptab
{
public string rnumber;
public string sname;
public string depart;
public string active;
public string dsexecstatus;
public string dsmsg = "";
}
OdbcConnection odcon;
OdbcCommand comm;
DataTable dt = new DataTable();
string con = "Dsn=VD;uid=dba;password=sql";
 
public List<Emptab> insert(string[] as_connstring, List<Emptab> value)
{
 
 
List<Emptab> tDataList = new List<Emptab>();
Emptab tdata = new Emptab();
try
{
List<Emptab> arr = new List<Emptab>();
tdata.rnumber = arr[0].rnumber;
tdata.sname = arr[1].sname;
tdata.depart = arr[2].depart;
tdata.active = arr[3].active;
string ls_query="";
if (as_connstring[0] == "GET")
{
ls_query = @"insert into student values('" + arr[0] + "','" + arr[1] + "','" + arr[2] + "','" + arr[3] + "') ";
odcon = new OdbcConnection(con);
odcon.Open();
comm = new OdbcCommand(ls_query, odcon);
comm.ExecuteNonQuery();

Answers (1)