string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strPath + ";Extended Properties='text;HDR=Yes;FMT=Delimited'";
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
try
{
OleDbCommand comm = new OleDbCommand("SELECT * from [" + strFilename + "]", conn);
OleDbDataReader read = comm.ExecuteReader();
while (read.Read())
{
xdlr = "HL" + read[0].ToString();
xname = read[1].ToString();
xaddr = read[3].ToString();
xcity = read[4].ToString();
xstate = read[5].ToString();
xzip = read[6].ToString();
xphone = read[7].ToString();
xfax = read[8].ToString();
xemail = read[9].ToString();
}
}
|