[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] SQL statement i C



|GeO| wrote:
> 
> Hej igen
> 
> Nu er den helt gal igen. Men jeg fik så god hjælp sidst så jeg prøver
> igen =) Jeg prøver at lave et sql statement der skal
> indeholde nogle argumenter fra funktions kaldet. ala
> 
> void printsql(char *name, int nr){
> //Klippet sql opstart ud her
> sqlstatement = "INSERT INTO dbname.tblname(name, nr) VALUES ('%1','%2')"
> //Klippet lidt her også
> }
> 
> Hvor %1 og %2 skal udskiftes med name og nr fra funktionskaldet. Er der
> en hurtig og let måde at gøre det på?

Tænker du på noget i stil med:

sprintf(sqlstatement,"INSERT INTO dbname.tblname(name, nr) VALUES
('%s','%d')", name, nr);

det er nok bedre med 'snprintf'

/Egon


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *