0

the thing is I am just a beginner and started learning .net. Can anyone tell me about the meaning of this statement. Here myrdr is the object of sqldatareader. Your responses are highly appreciated. And I had some pressure so got to learn things quickly. Please Reply and Thanks in advance.
Regards
TextBox1.Text = System.Convert.ToString(myrdr.GetInt32(0) + 1);

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by iDeveloper
0

sorry i write the whole code.

SqlConnection myconn = new SqlConnection(connstr);
                SqlCommand mycomm = new SqlCommand();
                mycomm.Connection = myconn;
                mycomm.CommandText = "select max(saleordno) from salesordmast";
                myconn.Open();
                SqlDataReader myrdr = mycomm.ExecuteReader();
                myrdr.Read();
                if (myrdr.IsDBNull(0) != true)
                {

                    TextBox1.Text = System.Convert.ToString(myrdr.GetInt32(0) + 1);
                }
                else                            
                    TextBox1.Text = "1";
0

It converts an integer value in column 0 to a 32 bit integer and adds 1 to it. Then it converts it to a string in order to assign it to a text box. If column 0 doesn't have a value it assigns a 1 to the textbox.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.