vradhik

vradhik

  • NA
  • 2
  • 0

Insert and retrieve data into excel

Nov 19 2007 1:18 PM

Hi

I am trying to select and insert data into excel using c#. I am able to insert and select successfully but the data type of the columns is sometimes a problem and i am unable to find out in which conditions this occur. I get either or both of these errors.

"No value given for one or more required parameters."

"Data type mismatch in criteria expression"

I set the column format as text in the excel sheet but after some inserts, the data type is no longer remaining as text and the sql to insert/retrieve does not seem to work.

My queries are like these

For selecting -

string str = "select Rating,Description from Feedback where SenderID=" + senderID.ToString() + " and ReceiverID=" + receiverID.ToString() ;

OR

string str = "select Rating,Description from Feedback where SenderID='" + senderID.ToString() + "' and ReceiverID='" + receiverID.ToString() + "'";

For inserting -

string str = "insert into Feedback values('" + senderID.ToString() + "','" + receiverID.ToString() + "','" + feedback.ToString() + "','" + comments.ToString() + "','" + projectID.ToString() + "')";

tx for any help!