DataSet ds = new DataSet();
System.Data.DataTable dtResults = new System.Data.DataTable();
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection("server=testserver;uid=testuser;pwd=pwd;database=testDB");
con.Open();
System.Data.SqlClient.SqlCommand cmd = new SqlCommand("SPName", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter DA = new SqlDataAdapter(cmd);
DA.Fill(ds);
if (ds.Tables != null && ds.Tables[0].Rows.Count > 0)
{
string ourstring = String.Join(",", ds.Tables[0].AsEnumerable().Select(x => x.Field<int> ("ColumnName").ToString()).ToArray());
}
0 Comments