Hey people you are doing it all false,
So step by step "*is
not working it shows array out of bound exception what I have to do
now.*" --> Your data reader have no column named "permission.aspx", so
instruction dr["permission"+".aspx"] is false and will throw an exception
everytime,
do that:
"*select username, password, permission from logi where
**userna...@username* <userna...@username>* and
**passwo...@password*<passwo...@password>
"
then do this Response.Redirect("~/" + dr["permission"].ToString() +
".aspx");
this might work.
Moez
To contact me in case of promblem : [email protected]
On 10 March 2010 16:27, crazy <[email protected]> wrote:
> 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
>