Solved

HTML to ACCESS97

Posted on 1997-04-02
5
206 Views
Last Modified: 2013-12-25
How do I send info from received from my page to an ACCESS97 database? Well, could someone give me a start. I know no-CGI. Could someone write a script that I might be able to edit and fill my needs. Basically, 2 drop down boxes, 4 text boxes. Thanks in advance for the help>
0
Comment
Question by:Ntboy69
  • 3
5 Comments
 
LVL 1

Expert Comment

by:Fordream
ID: 1827867
It would need custom program or script to do that. Maybe you should make the program or ask others for making it.
0
 

Author Comment

by:Ntboy69
ID: 1827868
Edited text of question
0
 
LVL 1

Expert Comment

by:topaz56
ID: 1827869
Try ACX2Web as the gateway...
It's freeware...
or else pay someone $2-$3K to do it for you
0
 
LVL 1

Expert Comment

by:topaz56
ID: 1827870
Try ACX2Web as the gateway...
It's freeware...
or else pay someone $2-$3K to do it for you
0
 
LVL 1

Accepted Solution

by:
topaz56 earned 100 total points
ID: 1827871
OK...this should get you started...

Here's an example in C++

1st, your web server's OS will need to support ODBC.  If you have an NT based Webserver, you are good to go.  2nd, you will need to setup a 32bit "System" datasource that points to your .mdc database.  Test your ODBC access to the database with a query tool of some sort.  Now you are ready to code an ODBC application to access the data.  Here is a Dynamic SQL function (and a main() shell to call it) that generates a table with the results of the query.  It uses custom "callout" functions to make the detail and table headings of the report customizeable (such as colored text based on value, or italics and bold). Visual C++ 4.2 used to compile the code.
-------------------------------------------------------- Code Starts
#include <Windows.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <ctype.h>
#include "SQL.H"
/* declare odbc function prototypes */
int DynamicSQL(UCHAR * server, UCHAR * uid, UCHAR * pwd, UCHAR *
sqlstr);
#define MAXCOLS 100
UCHAR * data[MAXCOLS]; /* This global variable must be defined with
function */
/* These are global functions for createing customized table output */
int print_err(HDBC hdbc, HSTMT hstmt);
void PrintRptHeadings(void);
void PrintRptDetail(int Field);
void InsertBlankRow(void);

#define CMD_COLOR "#dd5e01"  /* the "CMD,IPD,PPD... are unique to the
application I last used this function for */
#define IPD_COLOR "#0163a0"
#define PPD_COLOR "#8b3626"
#define TPD_COLOR "#018740"
#define FPD_COLOR "#53005c"
#define RED_COLOR "#ff0305"

/* global vars to hold list of cgi vars */
UCHAR RptName[32];
UCHAR Rpt;
int FirstTime;

/* main CGI program */

void main(void)
 .
  FirstTime = 1;
  printf("Content-type: text/html\n\n<title>Customer Survey
Report</title><basefont size=2><CENTER>");  /* output MIME header */
  Rpt = 1;   /* For Headings and Detail Direction */
  DynamicSQL("Surv", "admin", "", "Select QuestionID, QuestionText from
Questions \
order by QuestionID");
  printf ("</CENTER>");
  printf("</html>");
  fflush(stdout);  /* flush standard output */
 .

int print_err(HDBC hdbc, HSTMT hstmt)
 .
        printf("Error, handle this later denny!");
        return (0);
 .
/* Function to print custom headings instead of defaulted column names
*/
void PrintRptHeadings(void)
 .
        switch (Rpt)
        {
                case 0:
                                case 1:
                        break;
                case 2:
                        printf("<td align=center><b>Division</b>");
                        printf("<td align=center><b></b>");
                        printf("<td align=center><b>Name</b>");
                        printf("<td align=center><b>Q: #1</b>");
                        printf("<td align=center><b>Q: #2</b>");
                        printf("<td align=center><b>Q: #3</b>");
                        printf("<td align=center><b>Q: #4</b>");
                        printf("<td align=center><b>Q: #5</b>");
                        printf("<td align=center><b>Q: #6</b>");
                        printf("<td align=center><b>Q: #7</b>");
                        printf("<td align=center><b>Q: #8</b>");
                                        printf("<td
align=center><b>Mailed</b>");
                        break;
                case 3:
                        printf("<td align=center><b>Question</b>");
                        printf("<td align=center><b>Question
Asked</b>");
                        break;

                default:
                        break;
  }
 .
/* Function to print custom detail lines */
void PrintRptDetail(int Field)
 .
        char Percentage[10];
        static char hold_div[10];
        switch (Rpt)
        {
                case 0:    /* Print default */
                        break;
                case 1:    /* Print default */
                        if (strcmp(data[Field], "CMD") == 0)
                        {
                                printf("<td align=center><font size=2
color=%s><b>%s</b>", CMD_COLOR, data[Field]);
                                printf("<font size=2 color=%s><b>,
IPD</b>", IPD_COLOR);
                                printf("<font size=2 color=%s><b>,
FPD</b>", FPD_COLOR);
                                printf("<font size=2 color=%s><b>,
TPD</b>", TPD_COLOR);
                                printf("<font size=2 color=%s><b>,
PPD</b>", PPD_COLOR);
                        }
                        break;
                case 2:    /* First Report Detail Special processing */
                        switch (Field)
                        {
                                case 0: /* Division */
                                        if (strcmp(data[Field],
hold_div) != 0)
                                        {
                                                InsertBlankRow();
                                                if (strcmp(data[Field],
"CMD") == 0)
                                                        printf("<td
align=center><font size=2 color=%s><B>%s</B>", CMD_COLOR, data[Field]);
                                                else if
(strcmp(data[Field], "IPD") == 0)
                                                        printf("<td
align=center><font size=2 color=%s><B>%s</B>", IPD_COLOR, data[Field]);
                                                else if
(strcmp(data[Field], "FPD") == 0)
                                                        printf("<td
align=center><font size=2 color=%s><B>%s</B>", FPD_COLOR, data[Field]);
                                                else if
(strcmp(data[Field], "TPD") == 0)
                                                        printf("<td
align=center><font size=2 color=%s><B>%s</B>", TPD_COLOR, data[Field]);
                                                else if
(strcmp(data[Field], "PPD") == 0)
                                                        printf("<td
align=center><font size=2 color=%s><B>%s</B>", PPD_COLOR, data[Field]);
                                                else
                                                        printf("<td
align=center><font size=2><B>%s</B>", data[Field]);
                                               
strcpy(hold_div,data[Field]);
                                        }
                                        else
                                                printf("<td
align=center><B></B>");
                                        break;
                                case 1:
                                        printf("<td
align=center><B></B>");
                                        break;
                                case 2:
                                case 11:
                                        printf("<td align=left><font
size=2><B>%s</B>", data[Field]);
                                        break;
                                case 3:
                                case 4:
                                case 5:
                                case 6:
                                case 7:
                                case 8:
                                case 9:
                                case 10:
                                        if (strlen(data[Field]) == 1)
                                        {
                                                strcpy(Percentage,
data[Field]);
                                                strcat(Percentage,
".00");
                                        }
                                        else if (strlen(data[Field]) ==
2)
                                        {
                                                strcpy(Percentage,
data[Field]);
                                                strcat(Percentage,
"00");
                                        }
                                        else if (strlen(data[Field]) ==
3)
                                        {
                                                strcpy(Percentage,
data[Field]);
                                                strcat(Percentage, "0");
                                        }
                                        else if (strlen(data[Field]) ==
4)
                                        {
                                                strcpy(Percentage,
data[Field]);
                                        }
                                        else
                                        {
                                                strncpy(Percentage,
data[Field], 4);
                                                Percentage[4] = 0x00;
                                        }
                                        if (Percentage[0] == '4' ||
Percentage[0] == '5')
                                                printf("<td
align=center><font size=2 color=%s><B>%s</B>", RED_COLOR, Percentage);
                                        else
                                                printf("<td
align=center><B>%s</B>", Percentage);
                                        break;

                                default:
                                        break;
                        }
                        break;
                case 3:    /* First Report Detail Special processing */
                        if (Field)
                                printf("<td align=left><B>%s</B>",
data[Field]);
                        else
                                printf("<td align=center><B>%s</B>",
data[Field]);
                        break;
                default:
                        printf("<td align=center><font
size=2><B>%s</B>", data[Field]);
                        break;
        }
 .
void InsertBlankRow(void)  /* This is for control breaks */
 .
printf("<tr><td><td><td><td><td><td><td><td><td><td><td><td><tr>");
 .

---------------------------------------------------- Code Ends
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this tutorial I will aim to show you how simple is making a small application in WhizBase, how to add, remove and update data in the DB. I will make a small address book application where you can add, browse, update and remove addresses. I wi…
Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now