mysql - missing operator in query expression '.ID' -
i working on visual studio 2010 project wherein make database, create tables everytime run program , click button "create tables" message error occurs: "invalid table name" , " syntax error (missing operator) in query expression .'id' " can please me? codes:
imports system.data.oledb public class table public property auditionees string public property trainingagencydepartment string public property trainingagency string public property sid1 string public property sname1 string public property sfield1 string public property sage1 string public property saddress1 string public property scontact1 string public property bkid2 string public property bkname2 string public property bkaddress2 string public property bkcontact2 string public property bid3 string public property bauditioned3 string public property bconfirmed3 string public property bsid3 string public property bbnum3 string private sub querycommand(byval query string) try access.con.open() dim cmd new oledbcommand(query, access.con) cmd.executenonquery() catch ex exception msgbox("invalid table name") end try access.con.close() end sub private access new connection private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click dim query string = "" query = "create table " & auditionees & " (auditioneeeid counter primary key , auditioneename text, talent text, age int, address text, contact text ) " querycommand(query) query = "create table " & trainingagency & " (agencynumber counter primary key , agencyname text, address text, contact text ) " querycommand(query) query = "create table " & trainingagencydepartment & " (departmentid counter primary key , dateauditioned date, dateconfirmed date, auditioneeid int references ) " & auditionees & _ " (auditioneeid), agencynumber int unique references " & trainingagency & "(agencynumber)) " querycommand(query) form1.show() me.hide() end sub
end class
you should debug. try find run of querycommand fails. runs 3 times.
you should check, maybe 1 of table names missing.
you might debug querycommand because can "invalid table name" when connection failed. write out exception well.
Comments
Post a Comment