2012年3月22日星期四

any1 please really stuck! sql statement insert

Hi

I have the following insert statement

However it wont insert into the database

can any1 help or suggest tried everything

thanx

SqlCommand cmd2 = new SqlCommand("INSERT INTO room_type_temp (Room_code, Room_description, Room_notes, area, height, spanotes, pladescription, perdescription, floor, walls, ceiling, doorsets, glazing, windows, chanotes, hatch, air, lighting, noise, safety, awt, ast, amvs, amve, amvsu, ap, af, ah, lsi, lsn, lli, lcr, lslg, nasl, nsp, nt, sahs, AF2, sdhw, atn, amn, apn, lsin, lsnn, llin, lslgg, lcrn, nn, sn, fn, npf, nms, nin, fe, fad, Room_Sheet) SELECT Room_code, Room_description, Room_notes, area, height, spanotes, pladescription, perdescription, floor, walls, ceiling, doorsets, glazing, windows, chanotes, hatch, air, lighting, noise, safety, awt, ast, amvs, amve, amvsu, ap, af, ah, lsi, lsn, lli, lcr, lslg, nasl, nsp, nt, sahs, AF2, sdhw, atn, amn, apn, lsin, lsnn, llin, lslgg, lcrn, nn, sn, fn, npf, nms, nin, fe, fad, Room_Sheet FROM room_types where room_code = " + (Session["room_code"].ToString()), con);

Did you get error message? It seems that you missed single quote around session.

FROM room_types where room_code = " + (Session["room_code"].ToString()), con);

Should be

FROM room_types where room_code = '" + (Session["room_code"].ToString()) + "'", con);

|||

Hi

found it as well

used '" + room_code + "'

cheers!!!

:-)

没有评论:

发表评论