Lukifer122 Posted October 28, 2005 Posted October 28, 2005 WARNING... NEWBIE ALERT!!Ok, I've been teaching myself ASP, SQL and ADO, and I seem to have hit a dead end. I'm not able to get an answer anywhere for this, so hopefully I can get an answer here. I using an MSDE database with ONE table, and trying to insert/update records through an ASP page. The idea is that internet users can submit information for addition to the db. Well, while following along with the ADO section on W3Schools, I got the to ADO Add section, and customized the pages to suit my needs. I changed the code on the demo_add.asp page to display the error code, and it shows up as error: -2147217865. After searching around on google and newsgroups, this error matches tons of things, but not my scenario. Any suggestions anyone? I can post more info if needed! PLEASE HELP!
actionsketch Posted October 29, 2005 Posted October 29, 2005 My expertise is strictly with php and mysql, as is a huge number of the web developers out there. I guarantee you'll never find a queston in php that you can't google and find and answer pretty easily, and if you're teaching your self... you might consider switching over :)sorry I can't help you with your question... I've just seen this thread kinda laying there for a while and figured I might as well reply with something, eh?
Jerome Posted November 4, 2005 Posted November 4, 2005 Hi there,Please paste the complete error code and your asp code/sql query...
Lukifer122 Posted November 7, 2005 Author Posted November 7, 2005 Please paste the complete error code and your asp code/sql query...<{POST_SNAPBACK}> Error number: -2147217900INSERT INTO [maintenance] (datereceived,requesttakenby,priorityofissue,requestreceivedfrom) VALUES ('040404','four','mediumrare','4321') I have it display the submitted query after the error message, and that's what it spits out after I try to add a new record. As a side note, I can update records, just not add them. The ADO insert section on this site says this:"If the table contains a primary key, make sure to append a unique, non-Null value to the primary key field (if not, the provider may not append the record, or an error occurs) "I have a primary key field which is set to unique identifier. It should generate that on it's own should it not?
Jerome Posted November 7, 2005 Posted November 7, 2005 Ok, I still don't see what's going wrong... could you paste the code where you are trying to add a record?
Lukifer122 Posted November 7, 2005 Author Posted November 7, 2005 Ok, I still don't see what's going wrong... could you paste the code where you are trying to add a record?<{POST_SNAPBACK}> I removed my primary key (which was set as a uniqueidentifier) and the insert works just fine. So I guess my question now is "how can I append a unique ID to each record during the insert process?"-Luke
kansasprog Posted November 11, 2005 Posted November 11, 2005 I removed my primary key (which was set as a uniqueidentifier) and the insert works just fine. So I guess my question now is "how can I append a unique ID to each record during the insert process?"-Luke<{POST_SNAPBACK}> Why dont you use the ADO Record set to add new records.set conn = Server.CreateObject("ADODB.Connection")set rs = Server.CreateObject("ADODB.Recordset")rs.open "table",conn ' not sure something like this... rs.addnewif you have a primary key and its an unique key with autonumber,you dont have to specify here.. recordset takes care of it. (Do you have primarykey as a autonumber in your database)rs.fields("yourfieldname")rs.fields("yourfieldname1")rs.fields("yourfieldname2")and so on.... 'remember to update it.. rs.Updaters.close set rs = nothing and now close your connection... it should work
Lukifer122 Posted November 14, 2005 Author Posted November 14, 2005 Thanks for the tip! I'll be sure to try that our first thing in the morning! My dev kit finally arrived, so at least now I'll be working with more than just notepad. -Luke
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now