Author: therobot423 | Posted on: 11/24/2009 2:49:37 PM | Views : 292

Working on a school project, and what I'm trying to do is get a form on my *.aspx file to automatically contain the next ID that should go into my backend database.  In the aspx.cs file I have:
protected void Page_Load(object sender, EventArgs e) { String sqlCommand = "SELECT MAX(PEOP_ID) + 1 FROM PEOPLE"; using (SqlConnection connection = new SqlConnection(connString)) { connection.Open(); SqlCommand command = new SqlCommand(sqlCommand,connection); SqlDataReader reader = command.ExecuteReader(); reader.Read(); nextPeopId = Convert.ToInt16(reader[0]); reader.Close(); } }

And my form in the *.aspx file is:
<asp:TextBox ID="idbox" runat="server" ></asp:TextBox>
I just want the textbox to be automa ...

Go to the complete details ...