Stuck on INSERT... (1 Viewer)

Sergeant

Someone's gotta do it
Local time
Today, 03:47
Joined
Jan 4, 2003
Messages
638
Using VWD 2005 Express (2.0 framework)...
I need to get a querystring from the URL as the value for a field in the INSERT Command. So far, I'm stuck.
Any suggestions?
 

Sergeant

Someone's gotta do it
Local time
Today, 03:47
Joined
Jan 4, 2003
Messages
638
Yeah, I tried that in the preload event:
Code:
    Protected Sub Page_PreLoad(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreLoad
        Dim Pers As Integer
        Pers = Request.QueryString("PersID")
        
    End Sub
But where (and in what syntax) do I put that var in the INSERT command? Or do I put it in the insert command at all?
 

Kodo

"The Shoe"
Local time
Today, 03:47
Joined
Jan 20, 2004
Messages
707
what you should do is make a person class (i'm assuming persid is person) with all the attributes that the person table has. SO if your person table has ID, Fname, LName, DOB, SSN etc.. stuff like that, then your class will mirror that using properties. So then what I would do is have a button event.. so you click a button, the button event fires, you instantiate your person class and pass that class to your insert method. You then access the properties of the person object you just passed and add those as parameters to your sqlcommand.

So on the button event you capture request.querystring("persid") and pass it on.. make sense?
 

Sergeant

Someone's gotta do it
Local time
Today, 03:47
Joined
Jan 4, 2003
Messages
638
Yeah, I missed the lesson on "Classes".
Dude, it's like you're talking Greek, so it must be that you have drastically overestimated my understanding of this OOP stuff.

As far as my problem, I am having some luck now with putting a details view on the same page with a gridview and using the detailsview to insert the AssignPosition record based on the selectedIndex of the gridview.

Keep in mind that this is a huge paradigm shift for an idiot like me.

If you could put "Person Class" in plain text, what would it be?
 

Kodo

"The Shoe"
Local time
Today, 03:47
Joined
Jan 20, 2004
Messages
707
ok, classes are a programmatic/abstract represention of some object. A person has properties ,procedures, and methods. We have eyes, ears, skin etc.. we have routines (procedures) that we follow dailiy. We have functions that we perform when needed. A person class could represent this. Take a look at my examples in the VB.NET forum. I have a person class in those that you can look at.

What I REALLY recommend is dropping 60.00 on a lifetime subscription to www.learnvisualstudio.net and watch all the videos you possibly can. They will help you build a foundation understanding of OOP and .NET. It could take me 1000 posts to go over the same stuff when seeing it is so much easier.

Take a look at my class in the demo's. You can actually use that same class file in your project if you want to give you a boost.
 

Sergeant

Someone's gotta do it
Local time
Today, 03:47
Joined
Jan 4, 2003
Messages
638
Thank you for that.
In the cold light of morning, I don't think I'm THAT far from understanding this.
I know about class modules in Access, but those are created for you and neatly organized behind their respective objects.

I guess the idea is a bit too abstract for me in the .net environment. I keep wanting to hardwire everything like I would in Access. I really need to make the shift in my brain to think in terms of reusable services. I think this is where your suggested "People" class comes in to play?

I'll check out your examples.

Thanks again Kodo.

Sarge.
 

Users who are viewing this thread

Top Bottom