 |
|
 |
Good Example, I was looking for some application in which I can Import pre-manuplated data in Excel to be clubbed with my data manuplations in vb.net
|
|
|
|
 |
|
|
 |
|
 |
The link check it out here is broken
|
|
|
|
 |
|
 |
null value appears on the datagrid cell even if it has a corresponding value in the excel file.
example: [ excel1.xls ] contains sheet1
name | address
ABC | 345 gizmo st
DEF | 8 Abenson
so on ..........
the datagrid displays
name | address
ABC | null <-- this is my question
DEF | 8 Abenson
so on.............
#---------------
Dim DtSet As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source='" & PrmPathExcelFile & " '; " & "Extended Properties=Excel 8.0;")
' Select the data from Sheet1 of the workbook.
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection)
MyCommand.TableMappings.Add("Table", "name")
DtSet = New System.Data.DataSet
MyCommand.Fill(DtSet)
DataGrid1.DataSource = DtSet.Tables(0)
MyConnection.Close()
#----------------------------------------------
although the connection is correct, i just wander how it became "NULL"
any help would be appreciated.
|
|
|
|
 |
|
 |
hi,i am newbie to .net ,familiar with programming.
i have to read from excel file and write data onto sql server,
i cant sqlbulk copy as Excel file is not formatted.
please do through ,light on it.
give me some links or code ,i have to writ it in windows application using c#.
Thaks
|
|
|
|
 |
|
 |
Hi!!
I tried get a excel file, i'm using de sorce code, but i get de follow message error
'sheet1$' no es un nombre válido. Asegúrese de que no incluye caracteres o signos de puntuación no válidos y que el nombre no es demasiado largo.
'shet1$' isn't a valid name, so, what is the problem?
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [sheet1$]", MyConnection)
MyCommand.TableMappings.Add("Table", "Attendence")
DtSet = New System.Data.DataSet
MyCommand.Fill(DtSet)
|
|
|
|
 |
|
 |
sir i am in extreme discontent with my programming.
i wonder how the applications could communicate with its data.
sir, i am in a problem that i have an excel sheet whoose data changes continuously(its related to nse bse). i want to get those data in my vb.net program. the problem is that the file is running and i am not able to connect using jet oledb engine.
plz help!! i would be very grateful.
Aman
|
|
|
|
 |
|
 |
sir i use this code for sending text message to excel through VB
excel.Worksheets.Cells(1, 1).Value = " Sample text to send to Excel"
In my project i use OLE Object for Drawing a graph.
But i cant able to Export the Graph in OLE box to excel
Please i request u to kindly help me to send code for exporting the
Object to Excel.
Am waiting for ur reply..
By
Harish (ramasamy.eee@gamil.com
|
|
|
|
 |
|
 |
sir i use this code for sending text message to excel through VB
excel.Worksheets.Cells(1, 1).Value = " Sample text to send to Excel"
In my project i use OLE Object for Drawing a graph.
But i cant able to Export the Graph in OLE box to excel
Please i request u to kindly help me to send code for exporting the
Object to Excel.
Am waiting for ur reply..
By
Harish (ramasamy.eee@gamil.com)
modified on Wednesday, April 16, 2008 6:30 AM
|
|
|
|
 |
|
 |
how to export excel sheet from gridview data and how to import that excel sheet into gridview?
|
|
|
|
 |
|
|
 |
|
 |
how to export excel sheet from gridview data and how to import that excel sheet into gridview?
|
|
|
|
 |
|
 |
I have tried to export an excel sheet from gridview. its working fine.
then i want import that excel sheet into gridview. but its shows error.
what i have to do....
its my code for export...
GridView gv = new GridView();
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=Cpu_Info.xls");
Response.Charset = "";
Response.ContentType = "application/x-msexcel";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
gv.DataSource = Load_DataTable(objBal.Load_CPUHistory(ddlCode.SelectedValue.ToString()), "Export");
gv.RowStyle.HorizontalAlign = HorizontalAlign.Left;
gv.AlternatingRowStyle.HorizontalAlign = HorizontalAlign.Left;
gv.GridLines = GridLines.Both;
gv.DataBind();
gv.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
|
|
|
|
 |
|
 |
Hey there all this is my first post here and my first app using VB.net, i have been using vb6 but am told to move to vb.net, what i am wanting to do it get all the data from a excel doc and put it in either a access database or a sql database, this part i will work out once i have got the data from the excel document, i have never done this in vb6 either
Thank
|
|
|
|
 |
|
 |
hi I am very new to excel can u help me to find out how to open the excel file after connection and how I can read and deal with the cells? do u have a sample code or do u know a link?
thanks in advance
|
|
|
|
 |
|
 |
I used the same method. However, some of my excel field contains an embedded apostrophe. Data came across as empty string. How would I handle this?
|
|
|
|
 |
|
 |
I have similar problem. All other fields are fine, except for those cells have one or more comma inside, and data become as empty string
Any idea how to fix this? Thanks in advance
usfp_nut wrote: I used the same method. However, some of my excel field contains an embedded apostrophe. Data came across as empty string. How would I handle this?
Easy...
|
|
|
|
 |
|
 |
I have similar problem......anyone know to fix it?
|
|
|
|
 |
|
 |
When I downloaded the code, the connection string was:
"Extended Properties=Excel 8.0;"
I added the HDR=Yes and IMEX=1 as per the article, but the syntax did not work.
After some digging, I changed the connection string to this:
..."Extended Properties=’Excel 8.0;HDR=Yes;IMEX=1′"
(note the spacing and introduction of the single quotes)
Then it worked and I did not get null values for populated cells.
|
|
|
|
 |
|
 |
Is there a way (without XML for older Windows versions) to send data from a datagrid to Excel?
|
|
|
|
 |
|
 |
my problem is that i want to display excel sheets on asp.net pages and at the sanme time i want to resume the formatting done in .xls file
plz help me
|
|
|
|
 |
|
 |
OleDbConnection con=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" +"Data Source="+
Server.MapPath("Uts.xls")+";"+"Extended Properties=\"Excel 8.0;HDR=Yes\"");
con.Open();
string Sql="SELECT * FROM [Sheet1$]";
OleDbCommand cmd=new OleDbCommand (Sql,con);
OleDbDataReader rdr=cmd.ExecuteReader();
DataGrid1.DataSource=rdr;
DataGrid1.DataBind();
|
|
|
|
 |
|
 |
Hi,
Easiest and fastest way to deal with Excel in .NET is by using 3rd party component. It's much faster and easier way then Excel Automation/Interop or OLEDB. Try using GemBox - Excel .NET component - component is free for commercial use but with limit of 150 rows.
Here you can see a list of reason why GemBox.Spreadsheet is much better tool to work with Excel then Excel Automation/Interop.
|
|
|
|
 |
|
 |
When I try to read an excel file, If the excel file is already close then I am able to read the data properly. If the excel file is already open then unable to read the actual data.
For example
A B C
I 10% 20%
J 5% 8%
K 3% 2%
My Connection string is
"Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source= ";Extended Properties=" & Chr(34) & "Excel 8.0;HDR=No;IMEX=1;" & Chr(34)
If the excel file close then the values in the dataset are perfect.
A B C
I 10% 20%
J 5% 8%
K 3% 2%
If the excel file open then the values in the dataset are as
A B C
I 0.1 0.2
J 0.05 0.08
K 0.03 0.02
I need output like 10%, 20% like .....
Any one can help me..............
Chandra Sekhar V
|
|
|
|
 |
|
 |
when loading the data using like connectionstring Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + txtArchivo.Text + ";Extended Properties=Excel 8.0; , some values leave like null, although the cells have a registered value, it wanted to know like solving it without having to enter the data again
luis.agape@gmail.com
lapthebest@hotmail.com
|
|
|
|
 |