How to use the varchar data type in c#? -
i have piece of code , want make varchar not string. appropriate syntax in c#
string emri = row["nome"].tostring();
i have query have run , use emri in , compare column in table have created in mysql. column in mysql of type varchar(20). when execute code gives error in query , guessing maybe reason
i have query string query = "if not exists(select * clienti codcliente= " + id + " , nome = '" + emri + "' , ragionesociale=' " + ragsoc + " ' , partitaiva=' " + piva + " ') insert clienti values(" + id + " ,' " + emri + " ',' " + ragsoc + " ',' " + piva + " ') else update clienti set( " + id + " ,' " + emri + " ',' " + ragsoc + " ',' " + piva + " ')";
and gives me problem
you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'if not exists(select * clienti codcliente= 1 , nomecliente = 'jo' @ line 1
there no varchar
type in c#.
a varchar
pretty string (of variable length in sql, obviously), have fine.
Comments
Post a Comment