ASP.NET - Error: while getting the data into dataset from dataadapter

Asked By Rohini Kuchadi
03-Feb-12 02:42 AM
  
This is the code which i have written for binding the data to the gridview.

 protected void btngo_Click(object sender, EventArgs e)
      {

       
        {
          con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;" +
              @"Data source= C:\Documents and Settings\Administrator\" +
              @"My Documents\rohinik.mdb");
       Da = new OleDbDataAdapter("select songs from playlist where start date = txtstrtdate.toshortdatestring and end date = txtenddate.toshortdatestring ", con);
        DataSet Ds = new DataSet();
        Da.Fill(Ds);      //Here am getting that error
        GridView1.DataSource = Ds;
        GridView1.DataBind();   


        }

 
      }

Error:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005).


Can i know why am getting this error.
  Reena Jain replied to Rohini Kuchadi
03-Feb-12 02:48 AM
Hi,

You might have a FieldName the same as one of the keywords. Try putting brackets around the [ FieldName ] . or you binding the dataset with two table and might be each of which having the same field name, so change these fields unique.
  Web Star replied to Rohini Kuchadi
03-Feb-12 02:53 AM
This error comes in these situation so you need to test all these could be happen in your database table
*Any reserved word are using in query.
* Any datatype convert problem means like you are trying to convert char a to int
*Common column name in two table which select in query that are look like ambiguousness
  dipa ahuja replied to Rohini Kuchadi
03-Feb-12 03:34 AM
Write the query correct way

OleDbDataAdapter Da = new OleDbDataAdapter("select songs from playlist where start_date '=" +
txtstrtdate.Text.ToString() + "' And end_date='" + txtEnddate.Text.ToString() + "'", con);
  Danasegarane Arunachalam replied to Rohini Kuchadi
03-Feb-12 03:50 AM
The problem is with the datasource. Normally OLEDB adopter does not like any space in the file path

  con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;" +
        @"Data source= C:\Documents and Settings\Administrator\" +
        @"My Documents\rohinik.mdb");

Remove the file to any location in c: and test it or else enclose the filename within []

as

  con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;" +
        @"Data source= [C:\Documents and Settings\Administrator\" +
        @"My Documents\rohinik.mdb]");


But I would suggest to go for the first method
  kalpana aparnathi replied to Rohini Kuchadi
03-Feb-12 04:03 AM
hi,

For your solution purpose http://support.microsoft.com/kb/239482
Create New Account
help
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B A) What is scavenging? (B) What are different types of caching using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET sessions with classic ASP? (B) Which are the various modes of storing ASP.NET session
basic steps for that; • Defining the connection string for the database server • Defining the connection (OleDbConnection) to the database using a connection string • Defining the command (OleDbCommand) or command string that contains the query • Defining the Data Adapter (OleDbDataAdapter) using the command string and the connection object • Creating a new DataSet object • If the System.Data.OleDb namespace. The main objects you will use in this walkthrough are the OleDbConnection , OleDbCommand , and OleDbDataReader objects, and the DataGrid server control. Figure 1 The ADO.NET data access pipeline The OleDbConnection object handles the connection to the Jet database engine. The OleDbCommand contains the Microsoft SQL Microsoft Access 2002 • Visual Studio .NET Be sure you can create a simple Visual C# ASP.NET Web application before attempting the walkthrough. Walkthrough In this walkthrough, you will create a database Adding test data • Save the table and close Access. To display the database records The OleDbConnection object holds the connection string that connects the Jet database engine to the Pets.mdb displays them one record per row. • Open Visual Studio .NET. • Create a new Visual C# ASP.NET Web application at http: / / localhost / Pets. • Rename the file WebForm1.aspx to PetForm.aspx
http: / / www.aspsnippets.com / Articles / Read-and-Import-Excel-Sheet-into-SQL-Server-Database-in-ASP.Net.aspx HI try htis Stored Procedures For this article I have created two stored procedures created. When you run the above stored procedure first time you might get the following error message. Msg 15281, Level 16, State 1, Line 1 SQL Server blocked access to STATEMENT using the link below 2007 Office System Driver: Data Connectivity Components I faced the following Error while running the OLEDB Ace stored procedure Msg 7399, Level 16, State 1, Line 2 The OLE DB provider "Microsoft.Ace.OLEDB.12.0" for linked server "(null)" reported an error. Access denied. Msg 7350, Level 16, State 2, Line 2 Cannot get the column information server "(null)" Front End Design Below is the markup of the HTML mark of the asp.net web page. There are 2 panels. First with an upload button, Asp.Net FileUpload control and a label to display the status used to upload the Excel
Excel Reports in ASP.NET 2.0 In this article you will learn how to read data from Excel, generate tutorial, we will learn how to interact with Excel files, both reading and writing. Excel - ASP.NET Scenarios For the purpose of this tutorial, an Excel sheet had been prepared that holds on the selected table. Protected Sub btnSearch_Click( ByVal sender As Object , ByVal e As System.EventArgs) Handles btnSearch.Click Try Dim strExcelConn As String = System.Configuration.ConfigurationManager.ConnectionStrings.Item( "ExcelConnection" ).ToString() Dim dbConn As New OleDbConnection(strExcelConn) Dim strSQL As String strSQL = "SELECT * FROM [" & cmbSheets.SelectedItem.ToString() & "$]" dbConn.Open() Dim cmd As New OleDbCommand(strSQL, dbConn) Dim dsExcel As New DataSet Dim daExcel As New OleDbDataAdapter(cmd) daExcel.Fill(dsExcel) dgResults.DataSource = dsExcel dgResults.DataBind() Catch ex As Exception Throw ex sorted in Descending order. Protected Sub btnGenerateReport_Click( ByVal sender As Object , ByVal e As System.EventArgs) Handles btnGenerateReport.Click Try Dim strExcelConn As String = System.Configuration.ConfigurationManager.ConnectionStrings.Item( "ExcelConnection" ).ToString
image file upload hi all, how to upload images which are stored on system, using asp.net page and i have to store uploaded images into my solution explorer folder. i need can store into DataBase. Use this sample code for that- protected void btnUpload_Click(object sender, EventArgs e) { byte[] imageSize = new byte[FileUpload1.PostedFile.ContentLength]; HttpPostedFile uploadedImage = FileUpload1.PostedFile; uploadedImage.InputStream.Read uploadasp204(en-us, MSDN.10).gif Check this simple code: protected void btnUpload_Click( object sender, EventArgs e) { if (FileUpload1.HasFile) { try { string FolderPathToSave = Server.MapPath( "~ / images" ); / / Save Image in Images Folder url" , Path .GetFileName(FileUpload1.PostedFile.FileName)); comm.ExecuteNonQuery(); connection.Close(); } catch ( Exception ex) { Status.Text = "ERROR: " + ex.Message.ToString(); } } } hi, you can use html file control to upload the image. In btnUpload" OnClick = "btnUploadClick" Text = "Upload" / > < / form > In aspx.cs page protected void btnUploadClick( object sender, EventArgs e) { HttpPostedFile file = Request.Files[ "myFile" ]; if (file ! = null && file.ContentLength ) { string fname = Path.GetFileName save to a folder and save the path to database protected void btnSubmit_Click(object sender, EventArgs e) { / / Get Filename from fileupload control string filename = Path.GetFileName(fileuploadimages.PostedFile.FileName); / / Save images an HTML form for a client to be able to submit a file to your ASP.NET application. Receiving Uploaded Files < INPUT TYPE = " file" corresponds to the System.Web.UI.HtmlControls