Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-30-2007, 03:35 AM
Junior Member
 
Join Date: Jun 2007
Posts: 10
Default Is there any user's manual with swfkit3.1?

I'm working on this ADO example in this thread:
http://www.swfkit.com/forum/thread_1_489.html

And our Administrator show us an excellent example on how to use ADO directly in actionscript.
Quote:
Originally Posted by SWFKIT
With Flash 8 + SWFKit Pro 3(SWFKit 3), you can use ADO directly in Action Script. Please try the following sample out.

http://www.swfkit.com/forum/attachments/adodb.zip
But is there any user's manual about how to use ADO directly in actionscript ? or any API reference on "ADODB" ?

I can't find these in the help file of SWFKit 3.1
Reply With Quote
  #2 (permalink)  
Old 07-02-2007, 03:19 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Is there any user's manual with swfkit3.1?

ADO Reference
http://msdn.microsoft.com/library/de...dooverview.asp
ADO Tutorial
http://www.w3schools.com/ado/default.asp
Reply With Quote
  #3 (permalink)  
Old 07-03-2007, 03:15 AM
Junior Member
 
Join Date: Jun 2007
Posts: 10
Default Re:Is there any user's manual with swfkit3.1?

Thanks for your response!

But I think it seems to be different between asp+ado and swfkit+ado

For example:
Code:
import SWFKit.*;
import ADODB.*;

var ax = new ActiveXObject("ADODB.Connection");
var conn = new _Connection(ax.Identifier);
var connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
      Global.getAdditionalFile("db//student.mdb");
conn.Open(connStr, "", "");
axr = new ActiveXObject("ADODB.Recordset");
var rs = new _Recordset(axr.Identifier);
var sql = "select * from STUDENT where id>4";
rs.Open(sql,conn,1,2);

rs.MoveFirst();

var rsr:Array = rs.GetRows();

_root.id = rsr[0,1];
_root.id is the Var of a Dynamic Text field in the root scene
I expected that the result will be "Monica" (the 6th student's name)
But it display "undefined" !

If I use this way:
Code:
......
rs.MoveFirst();

var flds = new Fields(rs.Fields);
var fld = new Field(flds.Item(0));

_root.id = fld.Value;
It will get "5"(the 5th student's id)!
this way , it works properly!

why? How to use GetRows() ?
Reply With Quote
  #4 (permalink)  
Old 07-03-2007, 12:03 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Is there any user's manual with swfkit3.1?

Ffish scripting language currently does not support the "GetRows" method, which returns a multi-dimensional array.
Reply With Quote
  #5 (permalink)  
Old 07-03-2007, 12:52 PM
Junior Member
 
Join Date: Jun 2007
Posts: 10
Default Re:Is there any user's manual with swfkit3.1?

In the example floder(http://www.swfkit.com/forum/attachments/adodb.zip), there is a floder named "ADODB", there are many .as files in it......I think it's the class files that "import ADODB.*" required

Here's the code of _Recordset.as
Code:
import SWFKit.*;
import flash.external.*;

class ADODB._Recordset extends SWFKit.ActiveXObject {
   public function _Recordset(id: Number) {
      ...
   }

   ....
   public function get CursorType() {
      return ExternalInterface.call("ffish_getprop", this.Identifier, "CursorType");
   }

   public function set CursorType(value) {
      ExternalInterface.call("ffish_setprop", this.Identifier, "CursorType", value);
   }

   public function get EOF() {
      return ExternalInterface.call("ffish_getprop", this.Identifier, "EOF");
   }

   public function get Fields() {
      return ExternalInterface.call("ffish_getprop", this.Identifier, "Fields");
   }

   ...
   public function get RecordCount() {
      return ExternalInterface.call("ffish_getprop", this.Identifier, "RecordCount");
   }

   ......
   public function AddNew() {
      return ExternalInterface.call("ffish_call", this.Identifier, "AddNew", arguments);
   }

   ...

   public function GetRows() {
      return ExternalInterface.call("ffish_call", this.Identifier, "GetRows", arguments);
   }

   ...

   public function Open(Source, ActiveConnection, CursorType, LockType) {
      return ExternalInterface.call("ffish_call", this.Identifier, "Open", Source, ActiveConnection, CursorType, LockType);
   }

   public function Requery() {
      ...
   }

   public function _xResync() {
      ...
   }

   public function Update() {
      ...
   }

   public function get AbsolutePage() {
      ...
   }

   public function set AbsolutePage(value) {
      ...
   }

 ...
   public function get PageCount() {
      ...
   }

   public function get PageSize() {
      ...
   }

   public function set PageSize(value) {
      ...
   }

  ...

   public function get Index() {
      ...

   public function Save(Destination) {
      ...
   }

}
There are many ADO function in it like
AbsolutePosition()
BOF()
CursorType(value)
Fields()
RecordCount()
AddNew()
GetRows()
MoveNext()
MoveFirst()
MoveLast()
Open(Source, ActiveConnection, CursorType, LockType)
AbsolutePage()
......
......
I want to know which functions are available?
All I want to do is just read my database(student.mdb), and make a list of the record,
Of course, there are many records in the student.mdb, so I want to divide them into many pages. Hence , operating the database involves many ADO functions, I want to know which functions are available in the SWFKit?
Reply With Quote
  #6 (permalink)  
Old 07-03-2007, 01:09 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Is there any user's manual with swfkit3.1?

That is the wrapper class of the RecordSet object, an object exposed by the ADODB ActiveX component. Almost all methods and properties of ADODB can be accessed in swfkit except "GetRows".



Reply With Quote
  #7 (permalink)  
Old 07-03-2007, 01:44 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Is there any user's manual with swfkit3.1?

We have built a patch so that swfkit can now receive 2-dimensional arrays from ActiveX components. That is to say, the "GetRows" method will work well in actionscript. Please tell us which edition of swfkit you are using, swfkit or swfkit pro. We will send you the patch.
Reply With Quote
  #8 (permalink)  
Old 07-04-2007, 01:49 AM
Junior Member
 
Join Date: Jun 2007
Posts: 10
Default Re:Is there any user's manual with swfkit3.1?

Great Work!
Thank you very much!

And I've tried the rs.PageSize rs.AbsolutePage rs.PageCount.....All of them work well!

I' m using SWFKit 3.11
Email: xygbeta@gmail.com

And another question:
Code:
......
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + 
Global.getAdditionalFile("student.mdb");
var ax = new ActiveXObject("ADODB.Connection");
var conn = new _Connection(ax.Identifier);
// Connecting to the database
conn.Open(connString, "", "");
....
the Open() method has three parameters. If I've set a password "123" for my student.mdb file, I call the Open() function in this way:
Code:
conn.Open(connString,"","123");
Am I right?

Thanks a lot!
Reply With Quote
  #9 (permalink)  
Old 07-05-2007, 01:17 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Is there any user's manual with swfkit3.1?

A password should be set in the connection string like

Code:
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
         Global.getAdditionalFile("student.mdb") + ";Jet OLEDB:Database Password=youpassword";
Reply With Quote
  #10 (permalink)  
Old 07-07-2007, 03:07 AM
Junior Member
 
Join Date: Jun 2007
Posts: 10
Default Re:Is there any user's manual with swfkit3.1?

Thank you again!

I've got a big problem with "dividing the recordset to many pages"

In the first keyframe I call a functon which can connect to database, and display the recordset:
Code:
showList("where id>0", 1); 

// there's a ComboBox , which can switch to the other pages
var pgListener:Object = new Object();
pgListener.change = function(e:Object) {      
   removeMovieClip("sComboxMc"); // remove the previous ComboBox
   showList("where id>0", e.target.selectedItem.data) // show the other page
}
sCombox.addEventListener("change", pgListener);
"where id>0" is a part of SQL Query.
"1" will communicate to the "rs.AbsolutePage" , that mean the first page.

showList() function's code is here:
Code:
function showList(whereCond, whichPage){
   var ax = new ActiveXObject("ADODB.Connection");
   var conn = new _Connection(ax.Identifier);
   var connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
      Global.getAdditionalFile("student.mdb");
   conn.Open(connStr, "", "");
   axr = new ActiveXObject("ADODB.Recordset");
   var rs = new _Recordset(axr.Identifier);

   var sql = "select * from student " + whereCond;
   rs.Open(sql,conn,1,2); 

   rs.PageSize = perPage; //perPage is a variable, its first value is 10
   allPages = rs.PageCount;
   allRcd = rs.RecordCount;

   rs.AbsolutePage = whichPage;   
   
   while (not rs.EOF and perPage > 0) {
      var flds = new Fields(rs.Fields);
      .....// show the fields
      flds.Release();
      rs.MoveNext();
      perPage -= 1;
   }


   // add a ComboBox to show the navigator of pages
   sComboxMc = this.createClassObject(mx.controls.ComboBox, "sCombox",1);
   for (var j=1; j<=pageCnt; j++) {
      sCombox.addItem({data:j, label:"Page"+j});
   }
   sCombox.setSize(85,22);   //ComboBox's size
   sCombox.move(100,100);  //its (x,y) position

   conn.Release();
   rs.Release();
}
When I preview the application, it works well!
The First Page shows properly.
The ComboBox shows properly too.
Then I change the ComboBox, select the second item(the value is "2",second pge), it crashs! it can't show the second page's record!
and the swfkit says:
Code:
ADODB.Recordset:Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.. See also: C:\WINDOWS\HELP\ADO270.CHM.
Could you please check my code ~ and help me find out the errors?
Thanks for advance!
Reply With Quote
Reply

Was this information helpful?    Yes No



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:25 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.