.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Custom component Table name dynamic table name

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :Sql Server
Hi All How to i call the table dynamiclly in to C# class library. I can able to call the columns names.. but i unable to call the table name.. please suggest it Example:   IDTSOutputColumn100 column = output.OutputColumnCollection[x]; columnInfos[x] = new ColumnInfo(); columnInfos[x].columnName = column.Name; columnInfos[x].Column_reference = column.CustomPropertyCollection[ "Column_reference"].Value.ToString(); columnInfos[x].bufferColumnIndex = BufferManager.FindColumnByLineageID(input.Buffer, column.LineageID); columnInfos[x].lineageID = column.LineageID;   geting the columns names .. how to i get table name...?? Regards Ram

View Complete Post

More Related Resource Links

Dynamic Data. Multiple Custom Pages For The Same Table



I've just started out my first project using Dynamic Data and I've been running into a series of problems. Dynamic Data doesn't seem to be swimming in documentation. Anyway, my setup is:

  • Visual Studio 2010
  •  .net 4.0
  • Dynamic Data Domain Service Web Application Project Template (I have the RIA Services for ASP .net installed)
  • using an Entity Data Model
  • using a DomainService class
  • ASP .net Membership

There are a couple of things I am trying to achieve:

  1. I have my scaffolding turned on for all the tables. I am using the RequiresRole attribute in order to restric access to some tables. I have understood how you can create a Custom Page Template for a certain table, no problems there. I would like to be able to use the default PageTemplates for lets say the Administrator role and the Custom Page Templates for another role; the idea would be that the Administrator would be able to edit anything in the DB, but the restricted user would receive a Custom Page with only a few actions available. Long story short: is there a way to access both the standard and custom templates?
  2. Related to question number 1: Can I have multiple Custom Page Templates for the same table? I saw someone asking

    Custom display name for a table in dynamic data.


    I know this has been asked before but I am working in VB and don't know C#. I want to display a custom name for my tables on a dynamic data page. So far I have located the name of the object in my LinqSQL data context which is SectionTable. When displayed I want SectionTable to appear as Section.

    I know something should go in the namechange class, but I don't know what! I have got this far:


    Imports Microsoft.VisualBasic

    Imports System.ComponentModel.DataAnnotations



    Partial Public Class SectionTable

    End Class

    Public Class namechange

    End Class


    Thanks in advance.

DataGrid: Tailor Your DataGrid Apps Using Table Style and Custom Column Style Objects


One of the most enduring challenges in writing user interfaces is figuring out how to display large amounts of data efficiently and intuitively without bewildering the user. The problem becomes particularly thorny when the interface must reflect hierarchical relationships within the data that the user needs to modify. The Windows Forms DataGrid control gives developers a powerful and flexible tool to meet this challenge. This article explains its basic operations and shows how to extend the DataGrid to display columns of data in an application-appropriate manner.

Kristy Saunders

MSDN Magazine August 2003

Implementing a custom Membership Provider vs. using aspnet_Profile table - Which should I do?


I wanted to expand the amount of information that is associated with each user(MembershipUser) in the ASPNETDB.MDF database file. Adding columns like FirstName, LastName, etc. So I began implementing my own custom Membership Provider. I created a derived MembershipUser class with the extra private variables that I wanted each MembershipUser record to store. Its basically done. Almost after I did this I stumbled across the columns in the ASPNETDB.MDF->aspnet_Profile table called "PropertyNames" and "PropertyValuesString".  Could I have simply used these two columns to accomplish what I was attempting to do or are these columns for global application configuration settings?  

Is the aspnet_Profile table purpose to store expanded/related information about users such as personal information? Or is it for something else? Thanks.

create and insert into a dynamic sql table at runtime

Below I have a bunch of SQL statements that creates a table at runtime and the "pic" column is a dynamic column and the code creates the number of "pic" columns depending on the count of the uploader control.  the problem comes when I try to insert into that table and I am trying to say for every "pic" declare variable @pic.... it works well for just one file in the uploader but for multiple files i get the following error The name "pic1" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.Directory.CreateDirectory(MapPath(".") & "\port\" & clientname.Text & "\")        Dim objConn As New SqlConnection("Data Source=xxxxxxxxx.hostedresource.com; Initial Catalog=mrpoteat; User ID=xxxxxxx; Password=xxxxxxxxx;")        objConn.Open()        Dim strCommandText As String = ""        For index = 1 To Attachments1.Items.Count Step 1            If String.IsNullOrEmpty(strCommandText) Then                strCommandTex

insert into dynamic SQL Table at runtim

the follow ing is supposed to create a table and insert the columns into the table at runtime.  It also has picture column and creates the amaount of picture columns based on the amount of files in the multiple file uploaer.. it works fine with just one file in the uploader.  The problem comes when there  are two or more files in the uploader and intead of adding the second image right after the first image is added, it instead adds the first image then goes back and trys to create the table again, and i get an error saying the table already exsits.I want it to add the second image right after the first image, not go back and create the table then add the second imageDirectory.CreateDirectory(MapPath(".") & "\port\" & clientname.Text & "\")              Dim objConn As New SqlConnection("Data Source=xxx")        objConn.Open()        Dim strCommandText As String = ""        For index = 1 To Attachments1.Items.Count Step 1            If String.IsNullOrEmpty(strCommandText) Then                strCommandText = "

Record is already exists in Dimension table but still Kimball SCD Component is Identifying it as a n

Hi I have loaded Dimension table. Now even if the record already exists in my dimension table , every time I run package Kimball method SCD component is identifying as a new record. Please advise. Thanks, Anuja

Need help with dynamic table generation

I am building a test script to help myself figure out dynamic SQL.  My goal is to generate column names from an existing table query.  To work in this direction I made the following test: declare @sql varchar(1000) declare @int int set @int = 1 set @sql = 'declare @test table (' set @sql = @sql + 'testfield varchar(10),' while @int < 5 begin  if @int < 4   Begin    set @sql = @sql + ' field' + CAST(@int as varchar(10)) + ' varchar(10),'   end  else if @int = 4   begin    set @sql = @sql + ' field' + CAST(@int as varchar(10)) + ' varchar(10))'   end  set @int = @int + 1  end select (@sql) exec (@sql) insert into @test (testfield, field1, field2, field3, field4) values (1,2,3,4,5) When I run this query I get the following from the select (@sql) query: declare @test table (testfield varchar(10), field1 varchar(10), field2 varchar(10), field3 varchar(10), field4 varchar(10)) This looks good.  When I run the exec statement, this returns 1 Row affected, so, that seems to work.  However, when I run the insert I get this error: Server: Msg 137, Level 15, State 2, Line 23 Must declare the variable '@test'. I know that GO statements will effectively create batch dividers between statement groups, but, I haven't yet learned

Databinding to table that has a custom format

My problem is that I have a different format table for each section in my form. And I would like to bind data to these tables. A repeater I don't think is going to work. It would be great if I can do it like this:<table id="exampleOfWhatIWant" runat="server"> <tr> <td><%# Eval("data") %></td> <td><%# Eval("data") + 1 %></td> </tr> <tr> <td><%# Eval("data") + 2 %></td> </tr> <tr> <td><%# Eval("data") + 3 %></td> <td><%# Eval("data") + 4 %></td> <td><%# Eval("data") + 5 %></td> </tr> </table> Where the "+ 1" is the next record from that datasource --which is bound in code behind. Is there anyway, I can accomplish this without resorting to dynamically created tables (ugh).

Cannot call Table Valued Function from Dynamic stored procedure statement

Hello,  I have a table-valued function that splits string into a table column. I can easily call this function from a stored procedure within a regular SELECT statement: SELECT * FROM Table1 WHERE Code1 = '1' AND Code2 IN(SELECT * FROM [dbo].[fnSplitValues](@Code2String))   However when I try to use the same logic for a dynamic SELECT statement: ‘SELECT * FROM Table1 WHERE Code1 = '1' AND Code2 IN(SELECT * FROM ' + [dbo].[fnSplitValues](@Code2String) + ')’ I get an error ‘Cannot find either column "dbo" or the user-defined function or aggregate "dbo.fnSplitValues", or the name is ambiguous.’ Any idea what is wrong with my dynamic SQL?   Please help, Lana

How to submit data to a SQL Server database table from a custom page ?

Using SPD, I have created a custom page. It has a form with ASP.NET controls textbox, radio buttons, dropdown, submit button etc., Also, I created a Database connection (to the SQLServer database table) under Database Connections. But not sure how to connect this form to the database connection so that when form data is submitted, the data will be inserted into the table.

Get value of dynamic textbox in dynamic table with masterpages

Public Sub createtable() Dim b as Integer = 1 For i As Integer = 1 To b Dim tbl As New Table() Dim tr0 As New TableRow() Dim tr1 As New TableRow() Dim tr2 As New TableRow() Dim trh As New TableRow() Dim th As New TableCell() Dim td As New TableCell() Dim td0 As New TableCell() Dim td1 As New TableCell() Dim td2 As New TableCell() Dim td3 As New TableCell() Dim td4 As New TableCell() Dim td5 As New TableCell() Dim td6 As New TableCell() Dim td7 As New TableCell() Dim td8 As New TableCell() Dim td9 As New TableCell() Dim td10 As New TableCell() Dim td11 As New TableCell() Dim title As New DropDownList() Dim fname As New TextBox() Dim mname As New TextBox() Dim lname As New TextBox() Dim address As New TextBox() title.ID = "txtTitle" title.Items.Add("Mr.") title.Items.Add("Ms.") title.Items.Add("Mrs.") fname.ID = "txtfname" mname.ID = "txtmname" lname.ID = "txtlname" address.ID = "txtaddress" th.

dynamic table name linq-to-sql query


I am writing a function in which i generate autocode in specific format i want to make this function generalize so that i send tablename and columnname  parameter and function return the next code. I am using linq to sql with MVC e.g. i want to make table name and column name dyanamic

from m in db.<tblnameparam> 
                       orderby m.<colnameparam> descending
                       select m.<colnameparam>

can dynamic sql be used against a table variable?


This Works

create table #tmp1(rowID int)
declare @rowID int
set @rowID = 1
exec('insert into #tmp1(rowID) SELECT ' + @rowID)

This does not work

Declare @tmp1 table(rowID int)
declare @rowID int
set @rowID = 1
exec('insert into @tmp1(rowID) SELECT ' + @rowID)

Error Msg:
Msg 137, Level 15, State 2, Line 1
Must declare the variable '@tmp1'.

Is there a way to use Dynamic Sql against a Table var -- @tmp1?
How to do this?

The goal is to be able to pass in a string param like this to a proc

s1 = 'aa'',''bb'',''cc'

declare @s1 varchar(20)

Begin As

declare @tmp1(...)
exec('Insert Into ' + @tmp1 + ' (...) Where fldx In (''' + @s1 + ''')')


Add very dynamic controls to a asp:table


 Hi all. I want to create a TableRow with a TextBox. I want when click a Button a TableRow add to asp:table. in Button_Click event code I can add a row by a TableRow & TableCell & TextBox Objects and with help a HiddenField.
My problem is that: after add first row that has a textbox, next row doesn't add by click button. I think Controls delete after post back in server and first textbox delete and new textbox add same position. what is solution after every click, a row with textbox add to the table?

            TableRow tr = new TableRow();
            TableCell tc1 = new TableCell();
            TableCell tc2 = new TableCell();
            TableCell tc3 = new TableCell();
            TextBox txt1 = new TextBox();
            TextBox txt2 = new TextBox();
            DropDownList drp = new DropDownList(); drp.Width = Unit.Pixel(100);


How to add a Repeating Table to Sharepoint Custom List (via Customize Form)



I have create a InfoPath Form Library, and I have a repeating table on the InfoPath form. Now I want to submit the same Templete to a SharePoint List(with the repeating table), is it possible?  



Pivot table query dynamic column.


Hello All,


I want to export my data to excel sheet. The logic to export data in excel is clear.

Now my query is I have 3 tables and I want to generate the data jst like below.



Company Name

Company Email


Create Date


Fax No














And so on.....


The data will come from 3 tables I.e


  1. Master Table for Company

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend