Hi....I want to add plus one in Id...the problem is i have to show after getting id from database...code is

mycommand = new SqlCommand(query_Id, myconnection);
                reader = mycommand.ExecuteReader();
                 reader.Read();
                 txtID.Text = reader[0].ToString();
                 reader.Close();

for example in this case i m getting ID 3 in my text box but i want to show Id 4 because i want to add plus one...
kindly help me to type casting...
regards..

Recommended Answers

All 2 Replies

cast it to an int in your code int mynewvalue = (int)txtID.Text + 1

You can't cast a string into an int. You can Parse, or Convert a string into an int.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.