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
Durga Velusamy
NA
318
115.1k
please find the error
Apr 13 2015 1:58 AM
I have following code its shows an error please some one find what mistake I have done.
Error at 9
th
line as "
Input string was not in a correct format".
private
void
button2_Click(
object
sender,
EventArgs
e)
{
int
CustomerId=0;
int
i=0;
SqlConnection
con =
new
SqlConnection
(
@"server=CSE-PC; integrated security=true; Database=Bas"
);
con.Open();
SqlCommand
com =
new
SqlCommand
(
"select max(CustomerId) FROM DEVI"
, con);
CustomerId =
int
.Parse(com.ExecuteScalar().ToString());
/*Input string was not in a correct format.*/
if
(i>0)
{
CustomerId = CustomerId + 1;
}
else
{
CustomerId = 001;
}
comboBox1.Items.Add(
"CustomerId"
);
i = i + 1;
MessageBox
.Show(
"IdCreated"
);
con.Close();
}
Reply
Answers (
4
)
asp.net listbox and image
Relational insertion into the tables