title: Read excel Data as string from Excel using ODBC
body: <p>i am trying to read excel data to C# using ODBC here is my code </p>
  
  <pre><code> string    lstrFileName = "Sheet1";
              //string strConnString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq="+path+ ";Extensions=asc,csv,tab,txt;Persist Security Info=False";
              string strConnString = "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};Dbq=E:\\T1.xlsx;Extensions=xls/xlsx;Persist Security Info=False";
              DataTable ds;
              using (OdbcConnection oConn = new OdbcConnection(strConnString))
              {
                  using (OdbcCommand oCmd = new OdbcCommand())
                  {
                      oCmd.Connection = oConn;
  
                      oCmd.CommandType = System.Data.CommandType.Text;
                      oCmd.CommandText = "select A   from [" + lstrFileName + "$]";
  
                      OdbcDataAdapter oAdap = new OdbcDataAdapter();
                      oAdap.SelectCommand = oCmd;
  
                      ds = new DataTable();
                      oAdap.Fill(ds);
                      oAdap.Dispose();
  
  
  
                      // ds.Dispose();
                  }
  
              }
  </code></pre>
  
  <p>my sample data 
  <strong>A</strong>
  1
  2
  3
  AA
  BB
  its data table its read 1,2,3 and two blank row 
  i can understand because of first row its deciding data type , but how can i convert as String and read all row .
  Any suggestion .
  i Already tried CStr but no help . </p>