Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TXT-CSV file 2 grid
Message
De
07/03/2007 10:04:25
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
TXT-CSV file 2 grid
Divers
Thread ID:
01201486
Message ID:
01201486
Vues:
64
Hi all,

How to get this code working:
using System.Data.OleDb;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string strConn, strSQL;
        // strConn = "provider=SQLOLEDB; Data Source=E:\\_ASP\\TXTUzorak.txt; Extended Properties='text;HDR=No;FMT=Delimited'";
        strConn = "provider=SQLOLEDB; Data Source=E:\\_ASP\\TXTUzorak.txt;Integrated Security=True";


                  strSQL = "SELECT * from TXTUzorak.txt" ;
                 
        OleDbConnection cn = new OleDbConnection();
        cn.ConnectionString = strConn;
        cn.Open();
            
     
        //OleDbDataAdapter da = new OleDbDataAdapter(strSQL, cn);
        //DataSet ds = new DataSet();
        //da.Fill(ds, "Kupci");
        
        OleDbCommand    izvrsi = new OleDbCommand(strSQL, cn);
        OleDbDataReader citac  = izvrsi.ExecuteReader();

        cn.Close();

        GridView1.DataSource = citac;
        //GridView1.DataSource    = ds;
        //GridView1.DataMember    = "Kupci";
        GridView1.DataBind() ;   

    }
No error message available, result code: DB_E_ERRORSOCCURRED(0x80040E21).


Also, not clear this :

a) If I use //strConn, got "syntax error.."
b) are provider= and providerName= equal ?
c) if I use System.Data.SqlClient , got "not rgistered on this machine..."
d) I tried also alternate variant (with // in front) but no luck ...

TIA,
gojko
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform