cmd.CommandText = "select username, password, permission from logi where userna...@username <whereuserna...@username> and passwo...@password";
and Response.Redirect(dr["permission"] .Tostring () & ".aspx"); Thankx Vipin On Wed, Mar 10, 2010 at 1:12 PM, Jamie Fraser <[email protected]>wrote: > Replace > > > Response.Redirect(dr["permission"+".aspx"].ToString()); > > With > > Response.Redirect(dr["permission"] & ".aspx"); > > > On Tue, Mar 9, 2010 at 9:39 AM, santhoshvkumar > <[email protected]>wrote: > >> Hi all, >> Today I tried to design a login page of my own. Which contains >> username and password. In database SQL I hav 3 column username, >> password, permission. What I exactly need is I need to redirect to the >> page under the name of permission if user name and password get >> matches. So I tried the following coding. >> con = new SqlConnection(); >> string xx; >> con.ConnectionString = "Data Source=santhosh;Initial >> Catalog=ec;User ID=sa;Password=test"; >> con.Open(); >> SqlCommand cmd = new SqlCommand(); >> cmd = con.CreateCommand(); >> cmd.CommandText = "select username, password from logi where >> userna...@username and passwo...@password"; >> cmd.Parameters.Add("@username", SqlDbType.VarChar); >> cmd.Parameters["@username"].Value = TextBox1.Text; >> cmd.Parameters.Add("@password", SqlDbType.VarChar); >> cmd.Parameters["@password"].Value = TextBox2.Text; >> SqlDataReader dr = cmd.ExecuteReader(); >> if (dr.Read()) >> { >> >> Response.Redirect(dr["permission"+".aspx"].ToString()); >> } >> else >> MessageBox.Show("buzz"); >> >> But this Response.Redirect(dr["permission"+".aspx"].ToString());--- is >> not working it shows array out of bound exception what I have to do >> now. >> >> Thanks in Advance, >> Santhosh V Kumar >> > > -- "People who never make mistakes, never do anything." dEv
