Wednesday, March 7, 2012

how to store my results to another table

Hi guys,

now i was able to get the results of the query i made. and the remaining problem now is how can i store the results to my database?

here's the my code:


protected void btnGenerate_Click(object sender, EventArgs e)
{
_con = new SqlConnection(database.evgConnection());
_comm = new SqlCommand("EV_usp_SearchNoticeLocation", _con);
_comm.CommandType = CommandType.StoredProcedure;
_comm.Parameters.AddWithValue("@.Locationid", ddlLocation.SelectedValue);
_adapt = new SqlDataAdapter(_comm);
DataSet objDataset = new DataSet();
_adapt.Fill(objDataset);
GridView1.DataSource = objDataset;
GridView1.DataBind();

foreach(DataRow dr in objDataset.Tables[0].Rows)
{
Response.Write(dr["Docownerid"].ToString());
}
}

how can i store all the Docownerid to another database table?

you can write simple query which will create a new table in sql server from the select query result.

SelectfiledName intoNewTableName fromExistingTable.

i think this will help you.

Sanjay

No comments:

Post a Comment