I am getting an error as "public bool insert(DropDownList ddJnlCode, TextBox txtJnlName, TextBox txtArticleID, TextBox txtMspage, TextBox txtTable, TextBox txtImage, TextBox txtRDate, TextBox txtDDate, DropDownList ddStage, TextBox txtRemarks): not all code paths return a value"public bool insert(DropDownList ddJnlCode, TextBox txtJnlName, TextBox txtArticleID, TextBox txtMspage, TextBox txtTable, TextBox txtImage, TextBox txtRDate, TextBox txtDDate, DropDownList ddStage, TextBox txtRemarks) { try { string str; str ="insert into wip_articles(ArticleID,ProjectID,ProjectName,Mspageno,Tables,Images,Receiveddate,Duedate,Stage,Remarks) values('" + ddJnlCode.SelectedItem.Text + "','" + txtJnlName.Text + "','" + txtArticleID.Text + "','" + txtMspage.Text + "','" + txtTable.Text + "','" + txtImage.Text + "','" + txtRDate.Text + "','" + txtDDate.Text + "','" + ddStage.SelectedItem.Text + "','" + txtRemarks.Text + "')"; if(objsqlcon.Execute(str) == 1) { return true; } else { return false; } } catch { } }

Showing Answers 1 - 2 of 2 Answers

Ujjwal Prakash

  • Apr 15th, 2006
 

Hi,

You are getting this errror coz u are not returning anything in the catch(){} block.

Suppose your program generates an error, then the program execution will get inside the catch block, which is not returning any bool vaue, that's why it is giving an error.

Regards,

Ujjwal :)

  Was this answer useful?  Yes

Chakravarthi

  • Oct 5th, 2006
 

add return statement in catch block also.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions