ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Save (Insert) database records into Array using C# and VB.Net in ASP.Net<p>Hi&nbsp;ps222,</p> <p>Use&nbsp;ArrayList and insert the&nbsp;clgid to it.</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong>Namespaces</strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using System.Data; using System.Collections;</pre> <p><strong>VB.Net</strong></p> <pre class="brush: csharp">Imports System.Data</pre> <p><strong><span style="text-decoration: underline;">Code</span></strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[] { new DataColumn(&#34;usid&#34;, typeof(int)), new DataColumn(&#34;clgid&#34;, typeof(int)) }); dt.Rows.Add(3, 5); dt.Rows.Add(5, 6); dt.Rows.Add(3, 7); dt.Rows.Add(3, 10); DataSet dsddsds = new DataSet(); dsddsds.Tables.Add(dt.Select(&#34;usid=&#34; + 3).CopyToDataTable()); ArrayList whislist = new ArrayList(); foreach (DataRow cr in dsddsds.Tables[0].Rows) { whislist.Add(cr[&#34;clgid&#34;].ToString()); } Response.Write(String.Join(&#34; &#34;, whislist.ToArray())); }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Dim dt As DataTable = New DataTable() dt.Columns.AddRange(New DataColumn() {New DataColumn(&#34;usid&#34;, GetType(Integer)), New DataColumn(&#34;clgid&#34;, GetType(Integer))}) dt.Rows.Add(3, 5) dt.Rows.Add(5, 6) dt.Rows.Add(3, 7) dt.Rows.Add(3, 10) Dim dsddsds As DataSet = New DataSet() dsddsds.Tables.Add(dt.[Select](&#34;usid=&#34; &amp; 3).CopyToDataTable()) Dim whislist As ArrayList = New ArrayList() For Each cr As DataRow In dsddsds.Tables(0).Rows whislist.Add(cr(&#34;clgid&#34;).ToString()) Next Response.Write(String.Join(&#34; &#34;, whislist.ToArray())) End Sub</pre> <p><strong><span style="text-decoration: underline;">Output</span></strong></p> <p>5 7 10</p>https://www.aspforums.net:443/Threads/274279/Save-Insert-database-records-into-Array-using-C-and-VBNet-in-ASPNet/https://www.aspforums.net:443/Threads/274279/Save-Insert-database-records-into-Array-using-C-and-VBNet-in-ASPNet/Mon, 07 Jan 2019 06:09:45 GMT