telophase: (shikamaru - screw you i'm going home)
telophase ([personal profile] telophase) wrote2005-09-28 08:39 am
Entry tags:

Anyone speak ASP?

...and if wo, can you tell me what's wrong?


set conn = server.createobject("ADODB.Connection") 'establish ODBC connection
conn.CursorLocation = adUseClient
conn.open "Surveys"
Set RS = Server.CreateObject("ADODB.Recordset")
RS.CursorType = adOpenKeyset 'so we can add/delete records
RS.LockType = adLockBatchOptimistic 'only lock the records being added/deleted
RS.Open "2005FallSurvey", conn, , , adCmdTable
RS.AddNew 'create a new, blank record



Yeah, I suck at creating these type of connections because I completely fail to understand the logic, which is why for the last survey I went for a username/pass hardcoded into the script, but I know this is the more-used way.

And if there's nothing wrong with the above, then that means there's something wrong with the permissions in SQL Server and THAT is even worse, arg, because that means I have no idea how to set it so that Web scripts can get to it. And I know in that case the first thing someone says is going to be "Have you tried Books Online?" to which my answer is: Yes, and I can't figure out what the hell to search for to give me the answer - they tell me how to grant permissions to specific users, but I can't figure out what user the Web would be. Arg.


nothing gets [livejournal.com profile] telophase crankier than ASP

[identity profile] jarodrussell.livejournal.com 2005-09-28 02:20 pm (UTC)(link)
What error message are you getting? (I do not know ADODB stuff very well, but have muscled my way through a few, personal ASP/VBScript projects.)

[identity profile] telophase.livejournal.com 2005-09-28 02:32 pm (UTC)(link)
Heh, yeah, that would be nice to know, huh? It's telling me there's a syntax error near "2005". That's actually the bit where I just took the survey from 2 years ago and changed the name of the table it's opening from the old one to this.

Would SQL Server not like numbers starting a table name or something? Hrrrrgh.

[identity profile] jarodrussell.livejournal.com 2005-09-28 03:01 pm (UTC)(link)
Is "2005FallSurvey" a stored procedure? Your RS.Open command looks different than those I'm used to seeing (http://www.w3schools.com/ado/ado_recordset.asp).

[identity profile] telophase.livejournal.com 2005-09-28 04:28 pm (UTC)(link)
No, it's a table. I was pretty sure that the previous survey's entry in that spot was a table, ut I can't be entirely sure since the guy who did it torched that particular database after the survey, for some reason (and he's left for greener pastures, so I can't ask him). Hm. Maybe his entry was a stored procedure?

[identity profile] jarodrussell.livejournal.com 2005-09-28 04:36 pm (UTC)(link)
Looking at the link I posted, it almost seems like you need a query there.

[identity profile] telophase.livejournal.com 2005-09-28 04:39 pm (UTC)(link)
Hum. Thanks - I'll look at that, you've definitely given me an opening here to figure it out, and when I think aobut it, that sounds rather like it's the case. (I tend to beat my head against a wall thinking I've got something horribly wrong, and then someone says "Have you tried [bloody obvious easy thing]?" and that usually opens it up.)

(Anonymous) 2005-09-28 09:18 pm (UTC)(link)
Looks like you're on the right track now, but I still want to give you this link: http://www.asp101.com/samples/db_search.asp

It's a sample ASP query complete with code and faq. From a neat site with lots of similar little tutorials on this stuff. And, if you need more help, lemme know.

-bink

[identity profile] telophase.livejournal.com 2005-09-28 09:22 pm (UTC)(link)
Thanks, will go look. :)

From what I can tell, my biggest problem with ASP is that I don't have enough of a handle of what the potential problems are - it could be just about anything. But that's just newbieness - in PHP I'm at the point where, when I get an error, I already know a whole bunch of things it couldn't possibly be, so that reduces the universe of things I have to test. Just haven't got there in ASP yet. XD