Advertisement
Advertisement
| 01.24.2008 at 02:36PM PST, ID: 23109540 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: |
this.sQuery="select * from database_table"
System.Data.
IDataReader IReader = objConn.ExecuteReaderII("SECURITY", this.sQuery, true);
System.Data.
DataSet obj = new System.Data.DataSet ();
obj.Load(IReader, System.Data.
LoadOption.OverwriteChanges, new string[] { "available" });
//need to change this obj dataset's ID column to string.
if (obj.Tables.Count > 0)
{
if (!Cache.ContainsKey("report"))
Cache.Add("report", obj);
else
Cache[
"report"] = obj;
}
|
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 01.24.2008 at 09:46PM PST, ID: 20740398 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace ReplaceColumn
{
class Program
{
static void Main(string[] args)
{
// Simulate the creation of the dataset
DataSet ds = new DataSet();
DataTable dt = new DataTable();
DataColumn dc = new DataColumn("Id", typeof(int));
dt.Columns.Add(dc);
dc = new DataColumn("Value", typeof(double));
dt.Columns.Add(dc);
dt.Rows.Add(1, 1.1);
dt.Rows.Add(2, 2.2);
dt.Rows.Add(3, 3.3);
// OK, now that we have a dataset with data, add a column
dc = new DataColumn("IdAsString", typeof(string), "Id");
dt.Columns.Add(dc);
}
}
}
|