AutoHotkey Community

It is currently May 27th, 2012, 10:59 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 132 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9
Author Message
 Post subject:
PostPosted: February 4th, 2011, 5:30 pm 
Yes. I am pretty sure it isnt the permissions, as the permissions are the same for everyone. Its a small access DB i created myself.

The ADO code in VBA form submits the SQL without any permission issues.

I just need to work out how to tweak Seans ADO code so that I can use the Execute method.

http://www.w3schools.com/ado/met_conn_execute.asp


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2011, 8:22 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
you dont understand you dont need to do that
you can just bas the create drop etc query the same as the select

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2011, 11:00 am 
Any idea how I can get a database schema using the ADO functions?

I'm trying to build a simple tool to manipulate a database when MS Access isnt available.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2011, 12:45 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
Woudnt you use use a show,describe,explain type of sql command. Did you even think about this first? You may better go to google and check how its done. Ado purpose is to provide an entry point not replace sql

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2011, 1:59 pm 
Offline

Joined: October 4th, 2006, 2:15 am
Posts: 250
Location: Louisville, KY
doyle nli wrote:
Any idea how I can get a database schema using the ADO functions?

I'm trying to build a simple tool to manipulate a database when MS Access isnt available.


It may depend a bit on your provider, but the SQLDataReader usually has a method called GetSchemaTable that returns a DataTable object that has the column metadata describing the SQLDataReader's result set.

SqlDataReader.GetSchemaTable Method


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2011, 2:24 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
this is for dql server i beleive. this question is directed towards an access database

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2011, 2:37 pm 
Offline

Joined: October 4th, 2006, 2:15 am
Posts: 250
Location: Louisville, KY
I believe it's dependent on the provider. I know SQL Server and Oracle both support it, and it's supported by the OLEDBDataReader: OleDbDataReader.GetSchemaTable Method

I don't have Access and haven't used it so I'm not speaking from experience. However it looks to me like it probably supports it. Whether or not this is what doyle nli actually wanted I'm not sure, but it does greatly simplifies getting schema information about specific tables.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2011, 2:46 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
it would if so i dont have time to dig in now tho so lets hope he can do it with either your suggestion or sql commands

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2011, 7:26 pm 
Offline
User avatar

Joined: May 18th, 2010, 3:10 pm
Posts: 1179
Location: Sweden
Sweeeee3333t! This is exactly what I wanted/needed now, good to get synced data from online. Now, however, I can't quite get my head wrapped around this. I have used MySQL with PHP before, and basic COM, but nothing advanced (I really don't understand it 100%).

1) On page 7, there was an example by infogulch of an attempt of a wrapper for SQL calls for AHK_L. It didn't work however. Has anyone got a wrapper function that works for AHK_L (or AHK v2)?
2) Does that require some other library apart from the correct COM?
3) The input is SqlQuery(sql, connStr). What is connStr, my credentials? In which format? What is sql, the sqlquery? In PHP the query is:

Code:
mysql_query("SELECT * FROM news");


Would the equalivent in AHK be:

Code:
sql := "SELECT * FROM news"
Output := SqlQuery(sql, connStr)


Or what?

Very grateful for replies, as this acquired knowledge will be used to make the world a better place. *sings*

_________________
~sumon Appifyer AHK Nova halted Recommended: AHK_L (Why?)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2011, 7:45 pm 
Offline
User avatar

Joined: May 10th, 2007, 10:54 am
Posts: 649
Location: .switzerland
hi, I worked recently on a SQLLite OOP Wrapper. I plan also to support ADO over COM:
DBA 0.3 (OOP-SQL DataBase in AHK {SQLite})

Usage:
Code:
connectionString := "C:\my.db"
db := DataBaseFactory.OpenDataBase("SQLite", connectionString)
res := db.Query("Select * from Test")


Recordset (currently readonly)
Code:
   sQry := "Select * from Table"
   rs := db.OpenRecordSet(sQry)
   while(!rs.EOF){   
      name := rs["Name"]
      phone := rs["Phone"]  ; access the fields over column-name or Index

      MsgBox %name% %phone%
      rs.MoveNext()
   }
   rs.Close()


See the download in the linked Thread for a out of the box working example.

_________________
http://securityvision.ch
AHK 2D GAME ENGINE


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 29th, 2011, 2:54 pm 
Offline

Joined: May 12th, 2009, 2:37 pm
Posts: 640
Location: Gloucester UK
If it's of help to anyone I've posted three simple functions for working with an Access database. They use the native COM in AHK_L and can be found here:

http://www.autohotkey.com/forum/viewtopic.php?p=455415#455415

_________________
The sooner you fall behind, the more time you have to catch up.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2012, 10:28 pm 
I know this has been a dead thread for awhile, but after 4 hours of trying things, I used this code to successfully connect to a SQL server using my windows NT credentials. To most of you it's common sense, but in case there's someone else out there like me:

Code:
#include com.ahk

; Adjust sSource and sConnect appropriately
sSource  := "SELECT top 100 * FROM tbllpayer"
sConnect := "Provider=sqloledb;Data Source=servername;Initial Catalog=databasename;Integrated Security=SSPI; "

COM_Init()
prs :=   COM_CreateObject("ADODB.Recordset")
COM_Invoke(prs, "Open", sSource, sConnect)
Loop
{
   If   COM_Invoke(prs, "EOF")
      Break
   pFields   := COM_Invoke(prs, "Fields")
   Loop, %   COM_Invoke(pFields, "Count")
      pField:= COM_Invoke(pFields, "Item", A_Index-1)
   ,   sData .= COM_Invoke(pField, "Name") . ": " . COM_Invoke(pField, "Value") . "`r`n"
   ,   COM_Release(pField)
   COM_Release(pFields)
   COM_Invoke(prs, "MoveNext")
}
COM_Invoke(prs, "Close")
COM_Release(prs)
COM_Term()
MsgBox, % sData


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 132 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9

All times are UTC [ DST ]


Who is online

Users browsing this forum: iDrug and 55 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group