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);

Recommended Answers

All 2 Replies

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";

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.

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.