topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday December 13, 2024, 2:53 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: ASP.NET Issues  (Read 3418 times)

chedabob

  • Participant
  • Joined in 2006
  • *
  • Posts: 34
  • C# Master (if only!!!)
    • View Profile
    • Donate to Member
ASP.NET Issues
« on: May 18, 2007, 11:04 AM »
I've been asked to code a form for a website. The form contains 40 or so textboxes, so I just wrote some really long INSERT query (if there is a better way, please suggest it) to insert them in. Now, I keep getting "Object reference not set to an instance of an object" on the following code

OleDbCommand theCommand = new OleDbCommand();
        theCommand.Connection = theConnection;
        theCommand.CommandText = @"INSERT INTO [SQLserverSQL].[dbo].[Records]
           ([computerName]
           ,[operatingSystem]
           ,[serialNumber]
           ,[hardwareManufacturer]
           ,[modelType]
           ,[warrantyExpiration]
           ,[serverFunction]
           ,[retailCorporate]
           ,[dcenterStoreLocation]
           ,[rackNumber]
           ,[supportGroup]
           ,[cellNumber]
           ,[Product Number]
           ,[localAdminID]
           ,[localAdminPW]
           ,[cpuNumber]
           ,[cpuType]
           ,[cpuSpeed]
           ,[networkAdapters]
           ,[speedDuplex]
           ,[primaryIP]
           ,[secondaryIP]
           ,[riloName]
           ,[riloIP]
           ,[totalMemory]
           ,[totalDiskSpace]
           ,[C_OS]
           ,[D_Data]
           ,[E_Apps]
           ,[networkCableID]
           ,[power]
           ,[changeWindow]
           ,[appName]
           ,[businessOwner]
           ,[appVendor]
           ,[appSupportGroup]
           ,[appFunction]
           ,[appCode]
           ,[specialRequirements])
     VALUES
           (" + computerName.ToString()
           + "," + operatingSystem.SelectedIndex.ToString()
           + "," + serialNumber.ToString()
           + "," + hardwareManufacturer.SelectedIndex.ToString()
           + "," + modelType.SelectedIndex.ToString()
           + "," + warrantyExpiration.ToString()
           + "," + serverFunction.SelectedItem.ToString()
           + "," + retailCorporate.SelectedItem.ToString()
           + "," + dCenterStoreLocation.SelectedItem.ToString()
           + "," + gridLocation.SelectedItem.ToString()
           + "," + supportGrp.ToString()
           + "," + cellPagerNumber.ToString()
           + "," + productNumber.ToString()
           + "," + localAdminID.ToString()
           + "," + localAdminPW.ToString()
           + "," + cpuNumber.SelectedItem.ToString()
           + "," + cpuType.SelectedItem.ToString()
           + "," + cpuSpeed.SelectedItem.ToString()
           + "," + netAdapters.SelectedItem.ToString()
           + "," + speedDuplex.SelectedItem.ToString()
           + "," + primaryIP.ToString()
           + "," + secondaryIP.ToString()
           + "," + riloName.ToString()
           + "," + riloIP.ToString()
           + "," + totalMemory.ToString()
           + "," + totalDiskSpace.ToString()
           + "," + C_OS.SelectedItem.ToString()
           + "," + D_Data.SelectedItem.ToString()
           + "," + E_Apps.SelectedItem.ToString()
           + "," + netCableID.ToString()
           + "," + power.ToString()
           + "," + changeWindow.ToString()
           + "," + appName.ToString()
           + "," + businessOwner.ToString()
           + "," + appVendor.ToString()
           + "," + appSupportGrp.ToString()
           + "," + appFunc.ToString()
           + "," + appCode.ToString()
           + "," + specReq.ToString() + ")";

It occurs on the third line, but I don't know what's causing it, as this is the way I've always done it before. Any ideas?