dbTalk Databases Forums  

Sql Suery In Excell

mailing.database.myodbc mailing.database.myodbc


Discuss Sql Suery In Excell in the mailing.database.myodbc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
acholyte vb
 
Posts: n/a

Default Sql Suery In Excell - 09-28-2007 , 12:44 PM






--0-2067811758-1191001113=:33130
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Hai Everyone, Allow me to introduce myself,

My Name is Benny, I'am from Indonesia,

I have ben use mysqlodbc version 3.51 for my application,

Now I'am studying query sql in excell file, anyone can help me, i have code like this:

Note ; I Used vb 6 + Mysqlodbc 3.51 + Excell 2003 Prof

Dim cn As New ADODB.Connection
Dim com As New ADODB.Command
Dim rec As New ADODB.Recordset

Set cn = New ADODB.Connection

With cn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=C:\Tes Excell\Tes.xls;" & _
"Extended Properties=Excel 8.0;"
.Open

If rec.State = adStateOpen Then rec.Close
com.CommandText = "Select * from [sheet1$A1:C4]"
com.ActiveConnection = cn
rec.Open com, , adOpenDynamic, adLockOptimistic

rec.MoveFirst

Do While Not rec.EOF
MsgBox rec(0) + rec(1) + rec(2)
rec.MoveNext
Loop

End With



is there anyone can tell me, about query to find a record and manipulate it such as addnew, edit/update and delete but only current record, not all record in 1 sheet in excell file, anyone can help me, please i really need the solution,
because to find data in excell file, it's very hard because the record it not fix and range in my query will not able to fill my need, please help me, asap

thx 4 kindness, attention and solution

if you don't mind, you could send the sample directly to my email :
acholyte_rbo (AT) yahoo (DOT) co.id

Best Regard's

Benny


---------------------------------
Bergabunglah dengan orang-orang yang berwawasan, di bidang Anda di Yahoo! Answers
--0-2067811758-1191001113=:33130--

Reply With Quote
  #2  
Old   
Bonnett, John
 
Posts: n/a

Default RE: Sql Suery In Excell - 10-08-2007 , 09:48 PM






I have tried your code, with some minor changes to suit my machine, and
it works fine.=20

I ran the code as an Excel macro from inside another Excel sheet. I am
sure it would also work OK if I used VB6.

Do you realise this code does not use mysqlodbc at all?

Do you have to have your data in an Excel sheet? You know you can read
and manipulate an Excel sheet without using ADODB too.

You can ask me some more questions if you want.

John Bonnett

-----Original Message-----
From: acholyte vb [mailto:acholyte_rbo (AT) yahoo (DOT) co.id]=20
Sent: Saturday, 29 September 2007 3:09 AM
To: myodbc (AT) lists (DOT) mysql.com
Subject: Sql Suery In Excell

Hai Everyone, Allow me to introduce myself,

My Name is Benny, I'am from Indonesia,

I have ben use mysqlodbc version 3.51 for my application,

Now I'am studying query sql in excell file, anyone can help me, i have
code like this:

Note ; I Used vb 6 + Mysqlodbc 3.51 + Excell 2003 Prof

Dim cn As New ADODB.Connection
Dim com As New ADODB.Command
Dim rec As New ADODB.Recordset

Set cn =3D New ADODB.Connection

With cn
.Provider =3D "Microsoft.Jet.OLEDB.4.0"
.ConnectionString =3D "Data Source=3DC:\Tes Excell\Tes.xls;" & _
"Extended Properties=3DExcel 8.0;"
.Open
=20
If rec.State =3D adStateOpen Then rec.Close
com.CommandText =3D "Select * from [sheet1$A1:C4]"
com.ActiveConnection =3D cn
rec.Open com, , adOpenDynamic, adLockOptimistic
=20
rec.MoveFirst
=20
Do While Not rec.EOF
MsgBox rec(0) + rec(1) + rec(2)
rec.MoveNext
Loop

End With



is there anyone can tell me, about query to find a record and manipulate
it such as addnew, edit/update and delete but only current record, not
all record in 1 sheet in excell file, anyone can help me, please i
really need the solution, because to find data in excell file, it's very
hard because the record it not fix and range in my query will not able
to fill my need, please help me, asap

thx 4 kindness, attention and solution

if you don't mind, you could send the sample directly to my email :
acholyte_rbo (AT) yahoo (DOT) co.id

Best Regard's

Benny

=20
---------------------------------
Bergabunglah dengan orang-orang yang berwawasan, di bidang Anda di
Yahoo! Answers

--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=...ie.nctu.edu.tw


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.