Results 1 to 2 of 2
  1. #1

    MS Access, C# and Data Type Long

    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.

    Code:
    //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
    Kind Regards,
    Robert A Heeley
    Lightning Hosts: http://www.lightninghosts.net
    Fast Windows Hosting ASP.NET, ASP, PHP

  2. #2
    Join Date
    Aug 2002
    Location
    Southwest Michigan
    Posts
    935
    Would you not still want to escape it?

    VALUES("+uid+"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •