June 2, 2011 at 4:56 pm
rhlangley (5/31/2011)
Take the ID and @courseid values out of your insert statement. By having them there, you are attempting to give it specific values. Skip that value and start with name. It will automatically create the new value for the identity column.Bob L
Hahaha I feel like such a moron! Bob L, you rock the programming world!
It's now working PERFECTLY fine. Jeez =)
Hey Bob L, do you think you can help me with another issue I am having?
Here is the link: http://www.vbforums.com/showthread.php?p=4016502#post4016502
Basically I've used .selecteditem in all of my programs when I was using visual studios 2008. But for some reason, it gives me an error message in 2010.
Any ideas? I really appreciate your help! :hehe:
June 2, 2011 at 5:35 pm
talismc (6/2/2011)
GilaMonster (5/29/2011)
I appreciate what you're saying Gila Monster, but this isn't the problem that I am having. My code works well and is done accordingly to my clients specifications.My problem is that my SQL database is not auto-incrementing.
As I said...
When you have an identity, it must not be specified as part of the insert statement, as SQL handles the value. Change your insert statement to
INSERT INTO Course (Name, Abbrev, Details, Start_Date, Start_Time, Expiry_Date, Instructor, Type, Company, Cost)
VALUES (@courseName, @courseAbbrev, @courseDetails, @courseSDate, @courseSTime, @courseEDate, @courseInstructor, @courseType, @courseCompany, @courseCost);
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 2, 2011 at 8:45 pm
GilaMonster (6/2/2011)
talismc (6/2/2011)
GilaMonster (5/29/2011)
I appreciate what you're saying Gila Monster, but this isn't the problem that I am having. My code works well and is done accordingly to my clients specifications.My problem is that my SQL database is not auto-incrementing.
As I said...
When you have an identity, it must not be specified as part of the insert statement, as SQL handles the value. Change your insert statement to
INSERT INTO Course (Name, Abbrev, Details, Start_Date, Start_Time, Expiry_Date, Instructor, Type, Company, Cost)
VALUES (@courseName, @courseAbbrev, @courseDetails, @courseSDate, @courseSTime, @courseEDate, @courseInstructor, @courseType, @courseCompany, @courseCost);
So you did. Sorry, I was responding to the question about what data types I am using. I must have missed your insert statement.
Either way, it's fixed. I appreciate your help as much as I appreciate everyone's help.
Thanks again Gila Monster. :blush:
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply