Click here to Skip to main content
15,889,211 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionUnique user control Pin
Hans Ruck8-Dec-06 2:11
Hans Ruck8-Dec-06 2:11 
AnswerRe: Unique user control Pin
ednrgc8-Dec-06 2:56
ednrgc8-Dec-06 2:56 
GeneralRe: Unique user control Pin
Hans Ruck8-Dec-06 3:02
Hans Ruck8-Dec-06 3:02 
Questionvalidation controls are not working at all Pin
yogita charhate8-Dec-06 0:35
yogita charhate8-Dec-06 0:35 
GeneralRe: validation controls are not working at all Pin
MoustafaS8-Dec-06 1:31
MoustafaS8-Dec-06 1:31 
GeneralRe: validation controls are not working at all Pin
yogita charhate8-Dec-06 2:05
yogita charhate8-Dec-06 2:05 
AnswerRe: validation controls are not working at all Pin
ednrgc8-Dec-06 2:52
ednrgc8-Dec-06 2:52 
QuestionNeed Help !!! Bult Update with Dataset Pin
Dinuraj7-Dec-06 23:32
Dinuraj7-Dec-06 23:32 
Hi,

I am developing a web appication using asp.net with c#.
I am updating Dataset using datgrid EditItemTemplate and storing in cache.
finally i want to update my table using SqlAdaptor Update mathod but i am gatting error.Please help me..

This is my Dataset Update mathod:
public void grdEmployee_Update(Object o,DataGridCommandEventArgs e)
{
int id = (int)grdEmployee.DataKeys[e.Item.ItemIndex];
TextBox txtName,txtDesignation,txtSex,txtAge,txtSalary;
txtName =(TextBox)e.Item.Cells[0].Controls[0];
txtDesignation =(TextBox)e.Item.Cells[1].Controls[0];
txtSex =(TextBox)e.Item.Cells[2].Controls[0];
txtAge =(TextBox)e.Item.Cells[3].Controls[0];
txtSalary =(TextBox)e.Item.Cells[4].Controls[0];
if (Cache["EMPCACHE"]!=null)
{
DataSet dsUpdate= (DataSet)Cache["EMPCACHE"];
dsUpdate.Tables[0].Rows[e.Item.ItemIndex]["NAME"]=txtName.Text;
dsUpdate.Tables[0].Rows[e.Item.ItemIndex]["DESIGNATION"]=txtDesignation.Text;
dsUpdate.Tables[0].Rows[e.Item.ItemIndex]["SEX"]=txtSex.Text;
dsUpdate.Tables[0].Rows[e.Item.ItemIndex]["AGE"]=Convert.ToInt32(txtAge.Text);
dsUpdate.Tables[0].Rows[e.Item.ItemIndex]["SALARY"]=Convert.ToSingle(txtSalary.Text);
dsUpdate.AcceptChanges();
Cache["EMPCACHE"]=dsUpdate;
grdEmployee.EditItemIndex = -1 ;
grdEmployee.DataSource = dsUpdate;
grdEmployee.DataBind();
}}

Finally i am going to update on Database using this code
private void btnDatabaseUpdate_Click(object sender, System.EventArgs e)
{
try
{
string strConnection= System.Configuration.ConfigurationSettings.AppSettings.Get("ConnectionString");
SqlConnection con = new SqlConnection();
con.ConnectionString = strConnection;
SqlDataAdapter sda = new SqlDataAdapter("select ID,NAME,DESIGNATION,SEX,AGE,SALARY from EMPLOYEEDETAILS",con);
SqlCommandBuilder scb = new SqlCommandBuilder(sda);
sda.Fill(dsObj,"EMPLOYEEDETAILS");
DataSet dsUpdate = (DataSet)Cache["EMPCACHE"];
dsObj = dsUpdate.Copy();
int success=sda.Update(dsObj,"EMPLOYEEDETAILS");
dsObj.AcceptChanges();
grdEmployee.DataSource = dsObj;
grdEmployee.DataBind();
}
catch (Exception ex)
{
Response.Write("
" + ex.Message.ToString());
}
}

I am gatting this error:
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.

waiting for promp reply
AnswerRe: Need Help !!! Bult Update with Dataset Pin
Grapes-R-Fun8-Dec-06 6:44
Grapes-R-Fun8-Dec-06 6:44 
QuestionSelected index change Pin
Shriya Kapoor7-Dec-06 23:26
Shriya Kapoor7-Dec-06 23:26 
AnswerRe: Selected index change Pin
Dinuraj7-Dec-06 23:35
Dinuraj7-Dec-06 23:35 
GeneralRe: Selected index change Pin
Shriya Kapoor7-Dec-06 23:42
Shriya Kapoor7-Dec-06 23:42 
AnswerRe: Selected index change Pin
Deepalakshmi.V8-Dec-06 0:30
Deepalakshmi.V8-Dec-06 0:30 
GeneralRe: Selected index change Pin
Shriya Kapoor8-Dec-06 0:46
Shriya Kapoor8-Dec-06 0:46 
GeneralRe: Selected index change Pin
NasimKaziS8-Dec-06 0:54
NasimKaziS8-Dec-06 0:54 
QuestionHow to attached doc file of more than 20pages Pin
omi987-Dec-06 23:07
omi987-Dec-06 23:07 
AnswerRe: How to attached doc file of more than 20pages Pin
Guffa7-Dec-06 23:50
Guffa7-Dec-06 23:50 
AnswerRe: How to attached doc file of more than 20pages Pin
ednrgc8-Dec-06 2:58
ednrgc8-Dec-06 2:58 
Question.mdb file Pin
dhulipudi7-Dec-06 22:57
dhulipudi7-Dec-06 22:57 
AnswerRe: .mdb file Pin
Guffa7-Dec-06 23:57
Guffa7-Dec-06 23:57 
AnswerRe: .mdb file Pin
R.Palanivel8-Dec-06 1:05
R.Palanivel8-Dec-06 1:05 
QuestionAccess is denied Configuration file erro in in ASP.net Pin
Rajesh_K_Sharma7-Dec-06 22:39
Rajesh_K_Sharma7-Dec-06 22:39 
AnswerRe: Access is denied Configuration file erro in in ASP.net Pin
ednrgc8-Dec-06 2:59
ednrgc8-Dec-06 2:59 
Questionmaintain viewstate of materpage control irrespective of child content page Pin
bredenc7-Dec-06 22:27
bredenc7-Dec-06 22:27 
AnswerRe: maintain viewstate of materpage control irrespective of child content page Pin
VMSSanthosh7-Dec-06 23:07
VMSSanthosh7-Dec-06 23:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.