Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 9th, 2008, 11:12 PM
Authorized User
Points: 340, Level: 6
Points: 340, Level: 6 Points: 340, Level: 6 Points: 340, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: , OH, USA.
Posts: 70
Thanks: 17
Thanked 1 Time in 1 Post
Send a message via Yahoo to iceandrews
Default Insert New Row from Session Vars

Hello,

I'm *very* new to VB (in the .NET) area. I'm using visual studio 2008 and I've got to use to session variables to insert a new row into a database table.

So, I have 2 session variables captured from gridviews as follows:
Code:
//From page 1.aspx
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
    Dim ProdCodeSession As String
    Session("PCSV") = GridView1.SelectedDataKey.Value
    ProdCodeSession = Session("PCSV")
    Response.Redirect("Starworkinput.aspx")
End Sub

//From 2.aspx
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim ProdCodeParam As String
    ProdCodeParam = Session("PCSV")
End Sub

Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
    Dim ActSSNSession As String
    Session("ASSV") = GridView1.SelectedDataKey.Value
    ActSSNSession = Session("ASSV")
    **** PSEUDOCODE: Insert "PCSV", "ASSV" into SQLDSTABLE(PCSVColumn,ASSVColumn) ****
End Sub
I don't know how to use VB to connect to a sqldatasource and insert a row. Any help would be greatly appreciated. Thank you!

 
Old May 12th, 2008, 08:16 AM
Authorized User
Points: 340, Level: 6
Points: 340, Level: 6 Points: 340, Level: 6 Points: 340, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: , OH, USA.
Posts: 70
Thanks: 17
Thanked 1 Time in 1 Post
Send a message via Yahoo to iceandrews
Default

Resolved. Thanks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Security: Could someone falsificate session vars? Maxxim ASP.NET 2.0 Professional 5 February 13th, 2008 12:06 PM
How to insert row no automatically Jane SQL Server 2000 1 January 13th, 2006 12:20 PM
Dynamically Insert Row fs22 Javascript How-To 1 July 9th, 2005 04:47 AM
Pass session vars from C# to VB.Net khamutari ASP.NET 1.0 and 1.1 Basics 5 November 11th, 2004 11:43 PM
Why is it bad to put Objects into Session Vars? treycarroll Beginning PHP 3 August 18th, 2003 12:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.