TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
laurens romeijn
NA
7
0
System.ArgumentException: Input string was not in a correct format.
Jan 9 2009 5:19 AM
hi,
I got a weird problem. In the next code i fill a dataset with the result of a storedproc. if i execute the storedproc nothing is wrong. But at the point i fill the dataset it gives the following error:
System.ArgumentException: Input string was not in a correct format.Couldn't store <8.00> in totaal Column. Expected type is Int32.
_sql.Fill(da, result); gives the error.
this is the code:
public int test(int int1, string string1, ref DataSet result)
{
int returnValue = -1; // Set return value to error.
try
{
SQLConnect();
// Prepair sql command.
SqlCommand cmd = new SqlCommand("dbo.storedproc", _sql.Connection);
cmd.CommandType = CommandType.StoredProcedure;
// Add return parameter value.
SqlParameter retval = new SqlParameter("returnValue", SqlDbType.Int);
retval.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(retval);
// Create data adapter
SqlDataAdapter da = new SqlDataAdapter(cmd);
// Create dataset if not supplied
if (result == null)
result = new DataSet("ds1");
// Add sql command parameters.
cmd.Parameters.Add(new SqlParameter("Int1", int1));
cmd.Parameters.Add(new SqlParameter("String1", string1));
// Execute sql command.
_sql.Fill(da, result);
// Get return value.
returnValue = (int)cmd.Parameters["returnValue"].Value;
}
catch (SqlException sqlEx)
{
_sql.LOGtoFILE(string.Format("sql fout opgetreden. sqlEx = '{0}", sqlEx), "test");
}
catch (Exception ex)
{
_sql.LOGtoFILE(string.Format("fout opgetreden. ex = '{0}", ex), "test");
//_businessLayer.HandleException(ex, MODULE, "test");
}
finally
{
_sql.LOGtoFILE("method leave. succeded", "test");
}
return returnValue;
}
Reply
Answers (
5
)
display control selection handler in asp.net using javascript
check my code...how drag the controls like our toolbox control dragging