anujoberoi 0 Newbie Poster

Hey guys! I am using MS SQL Server 2005

I hv created a table with a column name 'serial' and I hv made it an Identity. The table has 20 records in it.

I hv created a texbox in my asp.net webpage in which I want

"a successive 'serial' number to be fetched from the database and displayed"

I am using the following C# code to implement this but when the webpage runs, the textbox shows:

"System.Data.SqlClient.SqlDataReader"

Kindly help

the Code:>

protected void Page_Load(object sender, EventArgs e)
    {
        con = new SqlConnection("Data Source=OBEROIS-PC\\SQLEXPRESS;Initial Catalog=dmrc1;Integrated Security=SSPI");
        con.Open();
        cmd1 = new SqlCommand("select min(serial) as minserial from Table_1", con);
        int x = 1; 
        int y = 20;
        int z=x;
        dr1 = cmd1.ExecuteReader();
        while(z<=y)
        {
            TextBox6.Text = dr1.ToString();

            z++;
        }
        con.Close();
    }
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.