Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

HTML to ACCESS97

Posted on 1997-04-02
5
Medium Priority
?
223 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 300 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to count occurrences of each item in an array.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

824 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