AMX DBWizard Скачать руководство пользователя страница 32

Programming i!-Database Plus

28

  i!-Database Plus and DBWizard

Putting It All Together

Once you have created all the files, it is time to put them to work. The first thing you want to do is 

put the database, the NetLinxDBInclude.asp file, and database server script in a path accessible by 

your web server. If you accepted the defaults when installing your web server, the root of the server 

most likely exists in 

C:\Inetpub\wwwroot

. The best thing to do is create a directory under this path 

and place the database (MDB file) and database server script (ASP file) in this directory. If you 

have your web server running, you should be able to call up the file in your browser. Try typing this 

into your browser's address window: 

http://192.168.012.175/DB/CDExample.asp

. This assumes 

your IP address is 

192.168.12.175

 and you placed your file in a directory called DB 

(

C:\Inetpub\wwwroot\DB

). Adjust these values to match your setup. If all goes well, you will see 

the following message:

<?xml version="1.0" ?>

- <rsUnknown>

- <scriptError>

    <errorNumber>0</errorNumber>

    <errorDescription>No SQL Supplied</errorDescription>

  </scriptError>

</rsUnknown>

If you do not get this message in your browser, there is no need to continue; NetLinx will not be 

able to access the database. There is a problem in the setup. If the file is not found, the path is likely 

to be wrong. If the script cannot connect to the database, the MDB file is not located in the same 

directory as the script or the DSN entry is improperly setup.

If you get a 

500 Internal Server Error

 message when trying to view this page in a web browser, 

the web server has not installed properly. You must correct this problem before proceeding. 

Once you can correctly view the database server script in your browser, double check the path 

setting in your call to 

DB_INIT_CLIENT

. Enter the following as the IP address (or server name): 

http://192.168.12.175

. The IP port number is usually 

80

. In this case, you should enter 

/DB/CDExample.asp

 as the path to the database server script.

Now you are ready to compile and download your AXS file. Make sure the NetLinxDBInclude.axi 

file is in the same directory as your AXS (and maybe AXI) files. Once you have compiled, 

downloaded and rebooted your Master, you should be able to access the database. If you are having 

any problems, check the NetLinx terminal using NetLinx Studio or Telnet and watch for error 

messages.

You may see the No SQL Supplied message without any other formatting. If you do, 
you are running a browser that does not support XML, but that is OK. You do not 
need an XML compliant browser, and NetLinx will be able to access the database.

Содержание DBWizard

Страница 1: ...instruction manual integration Solutions i DatabasePlus and DBWizard...

Страница 2: ...lity and your exclusive remedy shall be at AMX Corporation s option either a return of the price paid or b repair or replacement of the SOFTWARE that does not meet AMX Cor poration s Limited Warranty...

Страница 3: ...ge SQL 5 HTTP CGI and XML 6 HTTP Hyper Text Transfer Protocol 6 CGI Common Gateway Interface 6 XML Extensible Markup Language 7 Creating an ASP file 9 Creating an AXI file 9 Creating an AXS file 15 Ne...

Страница 4: ...i i Database Plus and DBWizard Table of Contents Webserver path 32 Absolute database path 32 NetLinx AXI file 32 NetLinx local IP port 32 NetLinx code prefix 32 Encapsulate 32 Writing Your AXS File 33...

Страница 5: ...is an application that helps you generate NetLinx code to access a PC database The NetLinx Master can read and write to the database via a web server connection DBWizard helps generate the SQL and Ne...

Страница 6: ...navigate to a directory other than the default install directory if desired Click Next 6 In the i Database Plus Shortcut Creation dialog select Install Shortcut Icons for the installed components on y...

Страница 7: ...rnal Server Error message when trying to view ASP pages in a web browser the web server is not installed properly You must correct this problem before proceeding Once the server PC is setup make sure...

Страница 8: ...Introduction 4 i Database Plus and DBWizard...

Страница 9: ...connect to a database type not listed contact the vendor and obtain the ODBC drivers for that database 3 Connect to the database This will vary depending on the database you chose If you chose a Micro...

Страница 10: ...CGI Common Gateway Interface CGI provides a simple way to pass parameters to a program from an HTTP request Most commonly the CGI parameters appear directly on the URL line For example http www someho...

Страница 11: ...ata var var name TotalRecords name data 3 data var struct array struct index 1 index var name TitleID name data 11101000 data var array name Artist name string Buffet Jimmy string array array name Tit...

Страница 12: ...llow Each record is wrapped in a struct struct pair and the columns of each record are represented by the var var pairs The index index pair represents the index into the array that this structure or...

Страница 13: ...t s time to program the NetLinx AXI file You need to include NetlinxDBInclude axi in order to provide access to the support functions that make your job much easier In the process of writing the AXI f...

Страница 14: ...QL and database setup information When building SQL statements you need to know the names of the tables and or view and usually the names of any columns you are interested in reading or writing Anothe...

Страница 15: ...that SQL considers invalid like spaces and dashes If you are using column names with these characters or continually get SQL syntax errors try wrapping the column names in a pair of brackets This is S...

Страница 16: ...trSQL UPDATE Titles SET Artist 27 strArtist 27 Copyright 27 strCopyright 27 Label 27 strLabel 27 ReleaseDate 27 strReleaseDate 27 Title 27 strTitle 27 TitleID ITOA slTitleID WHERE TitleID ITOA slTitle...

Страница 17: ...NT The first thing to do is create a series of variables that needed through the event To kick off the processing call DB_PROCESS_HTTP_HEADER which will parse the HTTP header information from the resp...

Страница 18: ...T TO THE WEB SERVER CLEAR_BUFFER sDB_CLIENT strBUFF SEND_STRING dvDB_CLIENT dB_BUILD_HTTP_GET sDB_CLIENT OFFLINE EVENT OFFLINE STACK_VAR LONG lCODE HTTP RETURN CODE INTEGER nLIST_PTR INDEX FOR RECORDS...

Страница 19: ...TAL 0 sTempListBox snTOTAL TYPE_CAST nLIST_PTR DB_DISPLAY_TITLES sDB_TITLES sTempListBox CLEAR BUFFER DB_ACK_QUE sDB_QUE sDB_CLIENT CLEAR_BUFFER sDB_CLIENT strBUFF The very last bit of code keeps your...

Страница 20: ...text The last bit of code uses information contained in your listbox The first Send_Command displays record information in the form displaying 1 10 of 100 The listbox also has a value you can send to...

Страница 21: ...y make sure the selected value is inside the selected list Using FFFF is an easy way to force the function to automatically position to the end of the list The last button is from your scroll bar slid...

Страница 22: ...rted to XML tag CDATAit Converts XML Parameter to CDATA format The CDATAit function is used when converting record sets to XML Syntax CDATAit strData Variables strData Represents the data to be wrappe...

Страница 23: ...es RunDBQuery returns an XML representation of a record set ErrorToXML Converts error code and descriptions to XML The ErrorToXML function is used to convert errors to XML Syntax ErrorToXML nNumber st...

Страница 24: ...0 bytes above the max URL size nDB_MAX_PARAM_SIZE 300 XML PARAMETER SIZE Maximum size of XML values and ASP cookie nDB_MAX_QUE_SIZE 10 WEB SERVER QUE SIZE Number of commands to allow in queue nDB_LIST...

Страница 25: ...ER NQ_TAIL QUEUE TAIL POINTER CHAR bQ_HAS_ITEMS 1 IF ANY ITEMS ARE IN THE QUEUE CHAR bQ_READY 1 IF READY TO SEND THE NEXT CMD INTEGER NQ_MAX MAXIMUM ENTRIES IN QUE CHAR bINIT 1 IF INIT STRUCTURE _sDB_...

Страница 26: ...Variables sDB_QUE Represents the sDB_QUE for a given database server script connection Required srHDR Required Represents a header to be added to the XML response to identify the response Required st...

Страница 27: ...turn code Required Return Values DB_GET_HTTP_ERROR returns a string formatted for the error code in the format HTTP_ERROR error code error description DB_GET_HTTP_HEADERS Reads the HTTP headers from a...

Страница 28: ...r script connection Required nPORT Represents the IP port of the web server for a given database server script connection If 0 is supplied 80 will be used Required strFILE Represents the Path and File...

Страница 29: ...Variable sTempListBox Represents the list box structure Required nIDX Represents the new starting index for the list box Required bFROM_SLIDER Set to 1 if value is a raw 0 255 value from a slider Requ...

Страница 30: ...Extracts the HTTP Headers Cookie value from an sDB_CLIENT structure The DB_PROCESS_HTTP_HEADER function is used to parse the response from the server DB_PROCESS_HTTP_HEADER looks for HTTP errors and...

Страница 31: ...haracters illegal in URL s are replaced with a hex code equivalent The DB_STRING_REPLACE function is used to convert SQL queries into CGI strings Syntax DB_MAKE_URL_STRING CHAR strSTR Variable strSTR...

Страница 32: ...t be able to access the database There is a problem in the setup If the file is not found the path is likely to be wrong If the script cannot connect to the database the MDB file is not located in the...

Страница 33: ...absolute paths for the database APS and AXI files If you move the project you will be prompted to look for the database Use the provided dialog to browse to the database The normal File menu New Open...

Страница 34: ...en query name is moved to the Queries box in the bottom right you are ready to build your next query You can enter multiple queries for any table or view in the database if you want to get different i...

Страница 35: ...you are finished If this file exists you will be prompted to overwrite it Webserver host name or IP address The address of the web server that is running the ASP file The NetLinx code will require th...

Страница 36: ...uded in your program If this file exists you will be prompted to overwrite it You should note that DBWizard will re generate the AXI file listed in the NetLinx AXI File text box Any changes you made i...

Страница 37: ...ou you still have some work to do The AXI generated by DBWizard now contains all the code necessary to read and write information to the database as well as the basic infrastructure required to send y...

Страница 38: ...e richardson TX 75082 USA 469 624 8000 800 222 0193 fax 469 624 7153 technical support 800 932 6993 033 004 2565 01 05 2005 AMX Corporation All rights reserved AMX the AMX logo the building icon the h...

Отзывы: