Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. C to SQL Connentivity

C to SQL Connentivity

Scheduled Pinned Locked Moved C / C++ / MFC
databasesql-serversysadmin
8 Posts 3 Posters 8 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DarkSorrow38
    wrote on last edited by
    #1

    I have written a C program to insert a row in SQL Server 2000 but it seems not to work.

    #include<stdio.h>
    #include<conio.h>

    int main(void)
    {
    int number;
    char fname[80], lname[80];
    clrscr();
    printf("Enter a number : ");
    scanf("%d",&number);
    printf("Enter your first name : ");
    scanf("%s",fname);
    printf("Enter your last name : ");
    scanf("%s",lname);
    execl sql include sqlca;
    execl sql insert into Table1
    values(number,",'",fname,"','",lname,"'");
    getch();
    return 0;
    }

    L D 2 Replies Last reply
    0
    • D DarkSorrow38

      I have written a C program to insert a row in SQL Server 2000 but it seems not to work.

      #include<stdio.h>
      #include<conio.h>

      int main(void)
      {
      int number;
      char fname[80], lname[80];
      clrscr();
      printf("Enter a number : ");
      scanf("%d",&number);
      printf("Enter your first name : ");
      scanf("%s",fname);
      printf("Enter your last name : ");
      scanf("%s",lname);
      execl sql include sqlca;
      execl sql insert into Table1
      values(number,",'",fname,"','",lname,"'");
      getch();
      return 0;
      }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Ishaan Karnik wrote:

      I have written a C program to insert a row in SQL Server 2000 but it seems not to work.

      Could you explain what it is that does not work?

      D 1 Reply Last reply
      0
      • L Lost User

        Ishaan Karnik wrote:

        I have written a C program to insert a row in SQL Server 2000 but it seems not to work.

        Could you explain what it is that does not work?

        D Offline
        D Offline
        DarkSorrow38
        wrote on last edited by
        #3

        The error i recieve while compiling

        Compiling ..\SOURCE\SQL.C
        Error ..\SOURCE\SQL.C 15: Undefined symbol 'execl'
        Error ..\SOURCE\SQL.C 15: Statement missing ;
        Error ..\SOURCE\SQL.C 16: Statement missing ;

        L 1 Reply Last reply
        0
        • D DarkSorrow38

          The error i recieve while compiling

          Compiling ..\SOURCE\SQL.C
          Error ..\SOURCE\SQL.C 15: Undefined symbol 'execl'
          Error ..\SOURCE\SQL.C 15: Statement missing ;
          Error ..\SOURCE\SQL.C 16: Statement missing ;

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Ishaan Karnik wrote:

          Undefined symbol 'execl'

          Well I guess there is no such command in the C language!

          D 1 Reply Last reply
          0
          • L Lost User

            Ishaan Karnik wrote:

            Undefined symbol 'execl'

            Well I guess there is no such command in the C language!

            D Offline
            D Offline
            DarkSorrow38
            wrote on last edited by
            #5

            I have taken the command from SQL The Complete Reference.

            L 2 Replies Last reply
            0
            • D DarkSorrow38

              I have taken the command from SQL The Complete Reference.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              It looks like unix command line codes instead of C, but maybe that's just me

              1 Reply Last reply
              0
              • D DarkSorrow38

                I have taken the command from SQL The Complete Reference.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Harold (above) is correct, these are Unix commands, so unless you are compiling in a UNIX system they will not be recognised. What exactly does the SQL book say about this?

                1 Reply Last reply
                0
                • D DarkSorrow38

                  I have written a C program to insert a row in SQL Server 2000 but it seems not to work.

                  #include<stdio.h>
                  #include<conio.h>

                  int main(void)
                  {
                  int number;
                  char fname[80], lname[80];
                  clrscr();
                  printf("Enter a number : ");
                  scanf("%d",&number);
                  printf("Enter your first name : ");
                  scanf("%s",fname);
                  printf("Enter your last name : ");
                  scanf("%s",lname);
                  execl sql include sqlca;
                  execl sql insert into Table1
                  values(number,",'",fname,"','",lname,"'");
                  getch();
                  return 0;
                  }

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  Ishaan Karnik wrote:

                  execl sql include sqlca; execl sql insert into Table1 values(number,",'",fname,"','",lname,"'");

                  See here.

                  "One man's wage rise is another man's price increase." - Harold Wilson

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups