 |
|
|
I tried the project and it works fine. But, if a long text (longer than 256 chars) is in the data field in excel, GetFieldValue() function returns truncated(256 bytes) text. Is there anyway to support long data in the database?
Thanks,
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi,
Please help me...
I want to fire a query against EXCEL sheet in Java servlet. I have a EXCEL sheeet with ID & Name columns. In Java I am getting some Name from user input and want associated ID.
Query I am using: String query = "Select * from [Sheet1$] where [Name] like " +"%"+search+"%"; where search is Java variable where I am getting user input.
It is giving me error "java.sql.SQLException: [Microsoft][ODBC Excel Driver] Syntax error in query expression '[Name] like %vir%'. "
Please help me how can I use 'LIKE' operator for this query. Or any other workaround...
Thanks...
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Have a large file that exceeds the number of rows in EXCEL and would like to write the files to ACCESS instead. Any ideas?
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
Hi,
the executable runs fine but when I compile the project and try to run it I get the following error message :
"Database error : The Microsoft Jet database engine could not find the object "demo_table". Make sure the object exists and that you spell its name ant the path name correctly."
What could it be? My version of Office?
Thanks,
Francis
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
I want to read data from excel sheet. I make two text box in my form name txtBEG and txtEND. I want to retrieve all dates between the begining date and end date whatever the user types in that text boxes. The connection is showing well. but I am facing lot of problem in it. I dont know why?
Everytime its showing an error messge "DataType mismatch" and the cursor is going to the data reader. can any one help me please in this regard by correcting the code.
***In my excel sheet i created the date field in date format like this 3/14/01(4th item in Type list box) and the excel is read only.
***I think the values are not converting in datetime value which the excel generates. Help me on this issue and correct the code please.....
My Code is Given below ------------------------
private void cmdTransferData_Click(object sender, EventArgs e) //==================================================== { Read_Excel(txtBEG.Text, txtEND.Text) }
private void Read_Excel(string begDate_In,string endDate_In) //===============================================
{ string strConn = ""; string pstrPassword = ""; string pstrFileName = ""; pstrFileName= "C:/TransRef.xls";
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Jet OLEDB:Database Password=" + pstrPassword + "; " + "Data Source= " + pstrFileName + "; " + "Extended Properties=Excel 8.0;"; //+
DateTimeFormatInfo dtF = new CultureInfo("en-US", + false).DateTimeFormat; string pstrFROM, pstrFIELDS, pstrWHERE; string pstrSQL = ""; Boolean blnOrderBy = false;
pstrFROM = "FROM [TRANSREF$] "; pstrFIELDS = "TD "; pstrWHERE = "WHERE TD >= '" + (DateTime.Parse(begDate_In)).ToString("d", dtF) + "' and TD <= '" + DateTime.Parse(endDate_In).ToString("d", dtF) + "' "; pstrSQL = "SELECT " + pstrFIELDS + pstrFROM + pstrWHERE;
OleDbCommand myCommand = new OleDbCommand(pstrSQL); OleDbConnection myConnection = new OleDbConnection (strConn);
myConnection.Open();
myCommand.Connection = myConnection;
OleDbDataReader myReader = myCommand.ExecuteReader();
int pCountRec = 0; string pRowVal = "";
while (myReader.Read())
{
pCountRec = pCountRec + 1; pRowVal = myReader["TD"].ToString(); MessageBox.Show(pRowVal); }
myConnection.Close(); }
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
Yes, I Have the same problem , please help us. Excel Formating problem .?!. or C++ Code Problem..?!
|
| Sign In·View Thread·PermaLink | 2.67/5 (3 votes) |
|
|
|
 |
|
|
hi, i wrote a project that takes data from database and saves it as an excel document. i tried to run the project on different computer but without giving any error, it stops running. i copied all the dll files and i have the same framework that i compiled the project. is there any way to deploy an office 2000 project? thanks for your concern.
|
| Sign In·View Thread·PermaLink | 2.00/5 (2 votes) |
|
|
|
 |
|
|
You mention in your article, that you canot read from az excel file without some formatting. I found this atrticle wich shows how to do this without formatting.
The link to this article is: http://www.idude.net/excel/articles/using_excel_file_datasources.asp
The info from the article: << There are a number of ways you can reference a table (or range) in an Excel workbook:
* Workbook Name Use the Workbook Name followed by a dollar sign (for example, [Sheet1$] or [My Workbook$]). A Workbook table that is referenced in this manner consists of the entire used range of the Workbook. "Select [column_names] from [Sheet1$]" * Cell Range Use the Workbook Name followed by a dollar sign with cell range appended to it! Don't forget to use the colon : between the starting and ending cell positions! "Select [column_names] from [Sheet1$A1:B10]" * Named Range This is a range of cells with a defined name "Select [column_names] from [Defined Name Range]" >>
For more info, read the entire article
|
| Sign In·View Thread·PermaLink | 2.67/5 (3 votes) |
|
|
|
 |
|
|
Hi Everyone, I've been a member for sometime now and have been reading a few things on this forum. This is the first time that I'm posting a request. Hope you all gurus will respond. I want to read/write MS excel sheets on Unix/solaris platform using C++. I did go through the article posted by Alexander Mikula on how to use ODBC and read excel sheets using CRecordset. But I'm not sure how to use ODBC connection in Unix/solaris. Please tell me ways to do it unix using C++.
Thanks. Tanz.
|
| Sign In·View Thread·PermaLink | 2.00/5 (4 votes) |
|
|
|
 |
|
|
Unix?
If Microsoft wanted to make their formats available (easily) to everyone no matter what platform they where on, they would have simply made it the easy way... That is, suppling an easy cross platform c/c++-api that you could link into your project.
I think its pretty obvious (with the excel-driver approach) that they don't want you to even consider using anything else than windows. (they also want you to pony up the dough for Microsoft(c) Office[tm])
Sorry for the one year late reply, I'm just very frustated that this sort of crap is allowed.
|
| Sign In·View Thread·PermaLink | 1.00/5 (3 votes) |
|
|
|
 |
|
|
I want to use SQL SELECT statement: Select * form demo_table where field_2 = ’†‘; but is doesn't support chinese
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hello, i try, but it don't works.
I get an Error: "Database error: The Micosoft Jet-Databasemodul couldt not find the 'demo_table' Object."
The App open the File correctly, but the Worksheet fails. WHY ???
MfG
BK
|
| Sign In·View Thread·PermaLink | 1.33/5 (3 votes) |
|
|
|
 |
|
|
I need a program which can read more than 2 columns, but when i try adding to: sSq1= "SELECT Field1, Field2 FROM [Sheet1$]", it can only take Field1 and Field2. When I try adding a thrid one in... it just won't work. Can someone please help me with this?
hellie
|
| Sign In·View Thread·PermaLink | 1.00/5 (2 votes) |
|
|
|
 |
|
|
I found out a method of how to use more than one column in the program. I am not sure if it is the official way to do it, but it works on my program so... here it is:
sSq1= "SELECT * FROM [Sheet1$]"
recset.Open(CRecordset::forwardOnly,sSql,CRecordset::readOnly);
recset.GetFieldValue("Field1",1); recset.GetFieldValue("Field2",2); recset.GetFieldValue("Field3",3);
hellie
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Alexander: I tried to run your demo readExcel on my PC and got an error message " Database error: Specified driver could not be loaded due to system error 182{Microsoft Excel Driver [*.xls}} " I don't know what that means, could you help?
Tina
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
When I read the FAQ's on these articles, the biggest problems seems to be the tables names. How can I know the table (sheetname) is demo_table? To provide a list of all tables/sheet in an excelfile, simply use the class CTable from the Microsoft DBFetch sample. (this sample project is on your visual C++ CD). With this table you can generate a list of all the tables in an excelfile.
|
| Sign In·View Thread·PermaLink | 2.00/5 (2 votes) |
|
|
|
 |
|
|
I tried using the CTable class, but the class did not return any table names. I did not receive any error messages. The program returned EOF(), when I tried to iterate through the tables (my spreadsheet has data).
Curiously, I tried "Sheet1" for the table name (which is the name at the bottom of the spreadsheet) and that did not work either.
Jacques
|
| Sign In·View Thread·PermaLink | 3.50/5 (2 votes) |
|
|
|
 |
|
|
 |
|
|
 Hi, I want to change the font style i.e. headers with bold and change some colors in the data tables (columns or rows) depending on the value. I dont know whether this can be done or not. Please guide me as i have not used excel before. I have to use MFC and i have excel 2003. Looking forward to a response. Thanks a lot in advance.
Regards,
Himanshu
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Thanks, Alexander, for your article.
I'm in a position to reading to write from a sheet excell, my problem is in deleting from excel.
I think that i'm not able open correctly CDataBase m_database
sql.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s",m_driver, m_filestr ); if (m_database.Open(NULL, false, false, sql)){ m_rc = new CRecordset ( &m_database ) ; if (m_database.CanUpdate( )) MessageBox(NULL,"è update","errore",MB_OK); //*********** always is not Updateble
sql.Format ( "SELECT * FROM Personale" ) ; m_database.ExecuteSQL ( sql ) ; m_rc -> Open ( CRecordset::dynaset,sql,CRecordset::none ) ; int count = 0 ; while ( m_rc -> IsEOF( ) != 1 ) { m_rc->GetFieldValue ( "Cognome", str ) ; if (!str.Compare( CognomeL ) ) { m_rc->Delete(); if (!m_rc->IsDeleted( ) ) MessageBox(NULL,"è cancellato","errore",MB_OK); } m_rc -> MoveNext( ) ; count++ ; } } else MessageBox(NULL,"non aperto","errore",MB_OK); m_rc -> Close( ) ; delete m_rc; m_database.Close( ) ;
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
Thanks, Alexander, for your article. I'm using your sample ReadExcel.exe: http://adam.stup.ac.ru/Developer/ArticleDetail.aspx?ar=1053&l=n&mi=97&mic=139 (the same ODBC excel reader) to read ReadExcel.xls. And it works fine. But if I change the very first item "aaa" to number (ex. 1) it dissapears from output! Looks like ODBC RecordSet cell type depends on cell type from previous row (hidden in header row?). Can not figure it out how to "reset" RecordSet buffer before reading next row. Do you have any suggestions to fix this problem? I want read all data as a text only.
Gennady
|
| Sign In·View Thread·PermaLink | 1.50/5 (2 votes) |
|
|
|
 |
|
|
Have you solved this problem? I'm think I'm having a similar problem, except I'm doing number and not text. If the first line after the column title is missing data (which sometimes is the case because not all fields are required), then the rest of the column can not be read in. Anyone have a solution to this? Thanks in advance.
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |