text file is
No TMNo EnNo Name GMNo Mode IN/OUT Antipass DateTime
1 1 1641 Harithasdsssdssd 1 1 0 06-18-2013 11:41:26AM
2 1 1641 1 1 0 06-18-2013 11:41:38AM
3 1 1641 1 1 0 06-18-2013 11:41:42AM
4 1 1641 1 1 0 06-18-2013 11:41:47AM
5 1 1641 1 1 0 06-18-2013 11:41:52AM
6 1 1641 1 1 0 06-18-2013 11:41:56AM
7 1 1641 1 1 0 06-18-2013 11:42:05AM
8 1 1641 1 1 0 06-18-2013 11:42:40AM
9 1 1642 1 3 0 06-18-2013 11:44:02AM
10 1 1642 1 3 0 06-18-2013 11:44:06AM
11 1 1642 1 3 0 06-18-2013 11:45:01AM
12 1 1641 1 1 0 06-18-2013 11:45:13AM
13 1 1641 1 1 0 06-18-2013 11:45:18AM
14 1 1641 1 1 0 06-18-2013 11:45:24AM
15 1 1641 1 1 0 06-18-2013 11:45:37AM
this is text file
and i Want the EnNo=1641 Deatils i wrote the code is
using System.Data.OleDb;
using System.IO;
using System.Data;
protected void Page_Load(object sender, EventArgs e)
{
string strDirName = Server.MapPath("~/NewFolder1/"); //store the directory path
string path = strDirName + "TextFile.txt";
string strFileName = "TextFile.txt"; //store file name
using (OleDbConnection con =
new OleDbConnection(@"Provider=Microsoft.Jet.OleDb.4.0;" + //oledb connection bcoz of txt files reading
"Data Source=" + strDirName + ";" +
"Extended Properties=\"Text;HDR=YES;FMT=TabDelimited\""))
{
con.Open();
{
string s = "select EnNo,DateTime from " + strFileName +" where EnNo=1641" ;
OleDbDataAdapter da = new OleDbDataAdapter(s, con);
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
Label1.Visible = false;
}
else
{
Label1.Text = TextBox1.Text + "Employee Id is Not Available";
}
}
con.Close();
}
}
But it give error (No value given for one or more required parameters.)
what is the solution for this..........