giulione
Messages postés2Date d'inscriptionlundi 14 février 2005StatutMembreDernière intervention26 juin 2006
-
26 juin 2006 à 18:37
cs_coq
Messages postés6349Date d'inscriptionsamedi 1 juin 2002StatutMembreDernière intervention 2 août 2014
-
26 juin 2006 à 22:21
Hi,
i have this text file
GENUARDI ADOLFO
90100
04800530828
VIA ORETO139
MARCHESE SALVATORE
90100
00464940824
IAZZA CARMINE 40
I must read 4 line each time and put into a database so till the end of the document,
i wrote this code but is not right
try
{
StreamReader sr=
new StreamReader("\\Program Files\\SIP\\clienti.txt");
string[] After;
ArrayList lines =
new ArrayList();
string line;
int lineb=0;
int conta=0;
while ((line = sr.ReadLine()) !=
null)lines.Add(line);
if(conta % 4==0){
string a = (
string) lines[0];
string b = (
string) lines[1];
string c = (
string) lines[2];
string d = (
string) lines[3];SqlCeConnection cn =
new SqlCeConnection("Data Source=\\Program Files\\SIP\\data.sdf");cn.Open();
string gg="INSERT INTO clienti(nome,CAP,piva,Indirizzo) VALUES('"+a.ToString()+"','"+b.ToString()+"','"+c.ToString()+"','"+d.ToString()+"')";SqlCeCommand cmd =