plz reply me ,I am not able to solve the problem,I want to know that how can I use a structure,a pointer to structure and passing arguments using host variables in c so that same variables could be used in SQL queries also....
Thanks in advance...
if u know abt any good link then also plz give the URL
RITESH

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sqlenv.h>
#include <sqlutil.h>
#define SQLDASIZE(n) (sizeof(struct sqlda) + (n-1) * sizeof(struct sqlvar))
#define TRUE 1
#define FALSE 0

EXEC SQL INCLUDE SQLCA;

int main()
{
int valid;
EXEC SQL BEGIN DECLARE SECTION ;
struct employee
{
short empno;
char name[15];
float sal;

}emp;
EXEC SQL END DECLARE SECTION ;
printf("IN THE MAIN\n");

printf("ENTER THE EMPNO :");
scanf("%d",&emp.empno);

printf("\nENTER THE NAME:");
scanf("%s",emp.name);

printf("\nENTER THE SAL :");
scanf("%f",&emp.sal);

EXEC SQL CONNECT TO sample USER udb USING tryudb;
printf("\nDATABASE CONNECTED\n");

valid = Called_Fun(emp);

printf("BACK IN THE MAIN\n");
return(1);
}
int Called_Fun( struct employee temp )
{
EXEC SQL BEGIN DECLARE SECTION ;
struct empolyee new;
EXEC SQL END DECLARE SECTION ;
new.empno = temp.empno;
strcpy(new.name,temp.name);
new.sal = temp.sal ;
printf("\nEMP ID %d :",new.empno);
printf("\nEMP NAME %s :",new.name);
printf("\nEMP SAL %f :",new.sal);
EXEC SQL INSERT INTO UDB.RIT_EMP VALUES(:new.empno,':new.name',:new.sal);
EXEC SQL COMMIT;
printf("RECORD NO INSERTED SUCCESSFULLY");
return(1);
}