Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursors?
Message
From
04/10/2011 16:24:24
 
General information
Forum:
ASP.NET
Category:
Databases
Title:
Miscellaneous
Thread ID:
01522833
Message ID:
01525575
Views:
42
>
>The # temp tables are visible in the connection that created it. #Temp tables created in the stored procedure are not visible in the outside batch - they live only in the scope of the SP.

Thanks. That's what I thought you had said but I am having a little trouble visualizing how to use it. Here's my problem: I want to construct a temporary table in the code behind of the webpage. The temporary table will be static (no editing, sorting etc.). The temporary table will then be displayed in a gridview on the page. So I have something like this in the markup:
<asp:GridView ID="GridView1" runat="server"  
			AutoGenerateColumns="True" >
			
		</asp:GridView>
and something like this in the code behind:
		Dim SQL As String
		SQL = "SELECT * INTO #TempConstraint FROM " + SourceTableRBL.SelectedValue
		Dim oConn As New SqlConnection(ConfigurationManager.ConnectionStrings("TIPConnectionString").ConnectionString)
		Dim oCommand As New SqlCommand(SQL, oConn)
		oConn.Open()
		oCommand.ExecuteNonQuery()
So now that a temp table has been created, how can I get it into my gridview? And secondly, how or when do I dispose of the connection to avoid problems?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform