Copying records from datatable to datatable

Posted in .net 1.0, .NET Component, Net 2.0 on February 10, 2009 by bimal4u

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles  Button1.Click

dsEmptyDatasetSP.Tables.Add(makeTable1)

dsEmptyDatasetSP.Tables.Add(makeTable)

 dtOriginalDataTable = dsEmptyDatasetSP.Tables(0).Copy  ‘copy into other table 

 dsEmptyDatasetSP.Tables(0).Merge(dsEmptyDatasetSP.Tables(1).Copy,  True)‘copying one datatable into some specific index table with dataset  

End Sub

Dim dsEmptyDatasetSP As New DataSet  

Dim dtOriginalDataTable As DataTable   

 Private Function makeTable() As DataTable  

 Dim result As New DataTable  

 For i As Integer = 0 To 1  

Dim dc As New DataColumn

dc.ColumnName =“Col”& i.ToString

dc.DataType =GetType(Integer)

Next

 For i As Integer = 0 To 5  

Dim dr As DataRow = result.NewRow

dr(0) = i
result.Rows.Add(dr) 

 Next 

Return  result  

End Function

Private Function makeTable1() As DataTable 
Dim result As New DataTable 
For i As Integer = 0 To   

 Dim dc As New DataColumn

dc.ColumnName =“Col”& i.ToString

dc.DataType =GetType(Integer)

 Next

 For i As Integer = 5 To 10  

 Dim dr As DataRow = result.NewRow

dr(0) = i

result.Rows.Add(dr)

Next

Return result  

End Function

How to work with XML In SQL Server 2005

Posted in Sql server 2005 on January 30, 2009 by bimal4u

 DECLARE @DSID  NVarchar(50),@XMLPath Nvarchar(100),@RoldId int,@Debug varchar(max) 

set @Debug=‘<Roles><Role code=”111″ name=”RoleName”><Persons><Person FName=”FName” LName=”LName” DSID=”564″ Email=”P@email.com” /><Person FName=”1FName” LName=”1LName” DSID=”1234″ Email=”P1@email.com” /></Persons></Role></Roles>’

set @RoldId = 111 

if  ( (convert(XML,@Debug)).exist(‘(/Roles/Role[@code= sql:variable(“@RoldId”)])’) =) 

Begin

 SELECT @DSID=(convert(XML,@Debug)).value(‘(/Roles/Role[@code= sql:variable(“@RoldId”)]/Persons/Person/@DSID)[1]’,‘nvarchar(50)’)

 print @DSID  

select * from  [Partner]  where [ID]=@DSID

 End

browser type in server-side code without the BrowserType object in ASP.NET

Posted in Net 2.0 on April 16, 2008 by bimal4u

For more information click on this link

http://support.microsoft.com/default.aspx?scid=KB;EN-US;q306576

Browser Detection Using ASP.NET

Posted in Net 2.0 on April 16, 2008 by bimal4u

Please click on below link

http://aspnet.4guysfromrolla.com/articles/120402-1.aspx

Client-Side Message Boxes in your ASP.NET

Posted in Net 2.0 on April 16, 2008 by bimal4u

Please click on this link

http://aspnet.4guysfromrolla.com/articles/021104-1.aspx