Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 18th, 2010, 02:22 PM
Registered User
 
Join Date: Nov 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using temp table to store and retrieve data

Hi,

I have to create a temp table to store data from a table in it using stored procedure and then retrive it from the code.
I need to save the data in the begining before it is deleted.And then after the inserts are done I want to update the tblcontactlist by referring to the temp table.

Can someone help me with this please?

Code:
Private Sub btnAssign_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAssign.Click
        Dim bUpdate As Boolean = True

        Try
            Dim strSql As String
            Dim strSql1 As String
            Dim dr As SqlDataReader
           

            'delete exist Employees
            strSql = "delete from tblBNIContactList where companyid=" & txtCompanyid.Text
            da.UpdateData(strSql)


            'Assign Employee
            Dim i As Integer
            For i = 0 To lbxSelectedEmployees.Items.Count - 1
                strSql = "insert into tblContactList(CompanyID, IssuePrefix, UserID, PM, DevMgr, AltIncAllCorr) values("
                strSql &= cboCompanyName.SelectedValue & ",'" & txtIssuePrefix.Text & "', '" & lbxSelectedEmployees.Items(i).Value & "', 0, 0, 0)"
                da.UpdateData(strSql)
            Next

            'Assign PM
            If cboPM.SelectedValue <> "" Then
                strSql = "update tblContactList set PM=1 where CompanyID=" & cboCompanyName.SelectedValue & " and UserID='" & cboPM.SelectedValue & "'"
                da.UpdateData(strSql)
            End If

            'Assign DM
            For i = 0 To lbxDM.Items.Count - 1
                If lbxDM.Items(i).Selected = True Then
                    strSql = "update tblContactList set DevMgr=1 where CompanyID=" & cboCompanyName.SelectedValue & " and UserID='" & lbxDM.Items(i).Value & "'"
                    da.UpdateData(strSql)
                End If
            Next

            'Assign QA
            For i = 0 To lbxQA.Items.Count - 1
                If lbxQA.Items(i).Selected = True Then
                    strSql = "update tblContactList set AltIncAllCorr=1 where CompanyID=" & cboCompanyName.SelectedValue & " and UserID='" & lbxQA.Items(i).Value & "'"
                    da.UpdateData(strSql)
                End If
            Next

            'Update Nocorr values for critical issues
            If nocorrvalue.Count <> 0 Then
                strSql = "update tblbnicontactlist set nocorr=1 where userid in(nocorrvalue)"
            End If


            _dbAccess.dbAccess.GetConnection.Close() 
            _dbAccess.dbAccess.GetConnection.Dispose()

        Catch ex As System.Exception
            _dbAccess.dbAccess.GetConnection.Close()
            _dbAccess.dbAccess.GetConnection.Dispose()

            bUpdate = False
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
store procedure, temp table kumiko SQL Language 2 January 15th, 2008 05:46 AM
Retrieve different data from same table /field W052107 Visual Studio 2005 7 August 6th, 2007 11:40 AM
Retrieve data from word table Paul_Tic Access VBA 2 May 26th, 2006 12:31 PM
How to retrieve data from an array to a table? penta Access 4 September 22nd, 2004 04:05 PM



All times are GMT -4. The time now is 01:08 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.