Web Hosting Talk







View Full Version : MS Access, C# and Data Type Long


rahsoftware
05-31-2005, 03:05 PM
Hello,

I am having great difficulty getting my code to work, why wont this work, UserID is the problem, UserID is a Long Interger in my MS Access Database and uid is long in c#, I have tried int, long and ulong it still does not work, it only works if you put a number in manually such as 2.


//Does not work
String strSQL2 = "INSERT INTO tblDetails([UserID], [Name], [Company], [Address Line 1], [Address Line 2], [City], [Post Code], [Country], [Telephone Number]) VALUES(uid, '"+tbName.Text+"', '"+tbCompanyName.Text+"', '"+tbAddressLine1.Text+"', '"+tbAddressLine2.Text+"', '"+tbCity.Text+"', '"+tbPostCode.Text+"', '"+tbCountry.Text+"', '"+tbTelephoneNumber.Text+"' );";

//works
//String strSQL2 = "INSERT INTO tblDetails([UserID], [Name], [Company], [Address Line 1], [Address Line 2], [City], [Post Code], [Country], [Telephone Number]) VALUES(14, 'd', 'd', 'g', 'fg', 'sd', 'sdg', 'dfdf', 'df');";


Thanks in advance,
Robert A Heeley

FW-Mike
05-31-2005, 03:13 PM
Would you not still want to escape it?

VALUES("+uid+"