如何在我添加的现有数据表中添加新列,但它是bofore行的结尾(how add new column in existing datatable i added but its is come end of the bofore rows)

   IT问题网   2021-03-11 00:00:00

问 题

我的数据表包含两列;



id值

----- -------

1 100

2 150



我想添加另一个这样的列,实际上是它的结尾了2和150

行,但我想从预览下面开始;



id值课程id

- ---- ------ ----------

1 100 1

2 150 1



请帮帮我,

pavan

解决方案

当你添加你的专栏时,我假设你说的是什么它被插入2,150行之后(例如)3,200。



如果是这样,那么这不是一列 - 它是一行。您想要向数据库的源添加一列,而不是尝试将其添加到表本身。



可能,您的datatable已加载或绑定到数据库源,用于查看在visual studio server资源管理器窗格中或在相应的数据库管理系统中添加列 - 用于mssql的sql management studio。

没有意义想要在datatable中的一个特定位置插入一行,因为它对用户不可见,您可以直观地将它放在您用于显示它的控件中的任何位置,如下所示,我将替换datagridview中的列。一个winforms应用程序。



 todomanager.controls.datagridviewimagebuttonsavecolumn col = new todomanager.controls.datagridviewimagebuttonsavecolumn(); 
dgvlinks.columns.insert(0,col);
dgvlinks.columns.removeat(1);




但是如果你必须放在特定位置试试;

 _mastertable.columns.add()。setordinal(index)

标签:何在添加现有数据表它是结尾



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

在c#和asp.net中使用LinkedIn API?(Working with LinkedIn APIs in c# and asp.net )

problem hey i was trying to design an asp.net based webs ...

设计模式的案例研究(Case Studies for Design Pattern)

problem hi everyone, though i found "design patterns exp ...

返回所有组件(Retur all components)

problem dears, i need a method to return all named contro ...

Picturebox控件不会触发鼠标事件(Picturebox control not firing mouse events)

problem i have a picturebox control in a groupbox control ...

Windows 7中的VB.net + Crystall报告问题(VB.net + Crystall report issue in Windows 7)

problem i have created windows application in vb.net 2005 ...

如何将数据表中的数据保存回数据库?(How to save the data in a datatable back into the database)

problem i have filled my datatable with my sqladapter ass ...

测试ip和developpe ip扫描仪(Test ip and developpe ip scanner)

problem hi friends, i want help !!! i need c ...

在.Net中使用WCF的3层(3 tier using WCF in .Net)

problem hi, i have developed a 3 tier application in vb. ...

连续循环不循环(Continual Loop Not Looping)

problem j have code that is suppose to continue looping l ...

vb中的动态按钮控件(Dynamic button control in vb)

problem hi, i''ve a 10x10 matrix of buttons. i need to c ...

动态创建按钮的事件处理程序(event handler for dynamically created buttons)

problem i''ve created 100 buttons dynamically. but how to ...

电子邮件提醒新文章评论(Email alert for new article comments)

problem hi, i recently posted a couple of articles to c ...

在asp.net 3.5中创建第三方组件(creating third party component in asp.net 3.5)

problem i am already created a chat application. now i wa ...

查询以显示指定月份和前一个月的两个表中的匹配记录(query to show matching records from two tables for a specified month and one month prior)

problem hi, i need to show matching records ...

日期在sqlserver中的表中自动增加(date increasing automatically in the table in sqlserver)

problem sir how to increase the date in the table automat ...

将RTF文件转换为Dataridview?有可能的? VB.NET(Convert RTF file to Dataridview It is Possible VB.NET)

problem i want to convert rtf file in datagridview it is ...

获取具有相同颜色的图像中的像素数。(get the count of pixels in an image with the same color.)

problem i need to get the number of pixels that contains ...

如何在asp.net中使用divpopup(How to use divpopup in asp.net)

problem hi , i want know how to use ppopup in webforms li ...

IIS7中的表单身份验证问题(Forms Authentication issue in IIS7)

problem hi, my asp.net application is working fine in my ...

值类型用作对象(Value Type functioning as Object)

problem even though value types often represe ...