GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Tech FAQs  >  Programming  >  ASP.NET
Go To First  |  Previous Question  |  Next Question 
 ASP.NET  |  Question 143 of 257    Print  
private void Button1_Click(object sender, System.EventArgs e)
{
con=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:signin.mdb;Persist Security Info=False");
string s;
s="select * from login where username='" + TextBox1.Text + "'and password='" + TextBox2.Text + "'";
ad.SelectCommand.CommandText=s;
ds=new DataSet();
ad.Fill(ds);
if(ds.Tables[0].Rows.Count>0)
{
Label3.Text ="valid user";
}
else
Label3.Text="Invalid user";

}


Whenever i am using adapter wizard there is no error. but through coding getting error as

Object reference not set to an instance of an object.

How to rectify it?

  
Total Answers and Comments: 3 Last Update: November 10, 2006     Asked by: K.Gajalakshmi 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
October 05, 2006 08:16:24   #1  
Chakravarthi        

RE: private void Button1_Click(object sender, System.E...

May be your no intializing the adapter class object . check once again the declaration & intiatlization block

ad = new OledbAdapter

ad.connection=con


 
Is this answer useful? Yes | No
November 05, 2006 23:46:34   #2  
Guru        

RE: private void Button1_Click(object sender, System.E...

try

{

OledbConnection con=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:signin.mdb;Persist Security Info=False");
string s;
s="select * from login where username='" + TextBox1.Text + "'and password='" + TextBox2.Text + "'";
OledbDataaAdapter ad=new  OledbDataAdaptead();

ad.SelectCommand.CommandText=s;
DataSet ds=new DataSet();
ad.Fill(ds);
if(ds.Tables[0].Rows.Count>0)
{
Label3.Text ="valid user";
}
else
Label3.Text="Invalid user";

}

catch(Exception ex)

{

Response.Write(ex.Message());

}


 
Is this answer useful? Yes | No
November 10, 2006 01:29:21   #3  
suryaprasad        

RE: private void Button1_Click(object sender, System.E...
can anyone explaine me what this pesist security info =false is thanks in advance
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape