Click here to Skip to main content
15,908,020 members
Home / Discussions / Database
   

Database

 
Questionhow to use now() function in the Access when I write SQL Pin
KSCsoft9-Jul-06 3:33
KSCsoft9-Jul-06 3:33 
AnswerRe: how to use now() function in the Access when I write SQL Pin
kumarprabhakar7410-Jul-06 1:14
kumarprabhakar7410-Jul-06 1:14 
AnswerRe: how to use now() function in the Access when I write SQL Pin
kumarprabhakar7410-Jul-06 1:15
kumarprabhakar7410-Jul-06 1:15 
QuestionData Source Reconciliation (Sybase) Pin
SSLaks9-Jul-06 1:41
SSLaks9-Jul-06 1:41 
Questionplease help me!!! Pin
kicap8-Jul-06 17:29
kicap8-Jul-06 17:29 
AnswerRe: please help me!!! Pin
Paul Conrad8-Jul-06 19:11
professionalPaul Conrad8-Jul-06 19:11 
AnswerRe: please help me!!! Pin
Eric Dahlvang10-Jul-06 3:26
Eric Dahlvang10-Jul-06 3:26 
Questionhow to update dataset after session cache? Pin
Ed 548-Jul-06 12:40
Ed 548-Jul-06 12:40 
I'm teaching myself ADO .NET, and am struggling with how to programmatically update a dataset after I have cached it and recovered it in an ASP .NET web app.

I want to use a DataAdapter to populate a DataSet, cache the DataSet in Session, then recover the DataSet in a different page, work on it, and update the database. I can populate the DataSet, cache it, recover it, and make changes. However, I cannot get the adapter.update(dataset, "table") command to work properly. Have tried multiple solutions, with multiple errors revolving around lack of INSERT commands, uninitialized connection strings, etc.

What programmatic steps must I take in a new page in order to reconnect that dataset with the origin database? Do I have to instantiate a new DataAdapter, build new commands, open a new connection, etc? Can I cache and recover any of the relevant objects (DataAdapter, SqlCommand, commandBuilder) and use them?

Here's the code to populate and cache the DataSet. It works fine (but may be excessive):

using (SqlConnection connection = new SqlConnection(connStr))
{
    try
    {
        SqlDataAdapter pointAdapter = new SqlDataAdapter();
        pointAdapter.TableMappings.Add("Table", "UserPoints");
        SqlCommand pointCommand = new SqlCommand();
        pointCommand.CommandText = "SELECT * FROM Points WHERE userID = @userID";
        pointCommand.Parameters.AddWithValue("@userID", userIDstr);
        pointCommand.Connection = connection;
        pointCommand.CommandType = CommandType.Text;
        pointAdapter.SelectCommand = pointCommand;
        SqlCommandBuilder pointCmdBuilder = new SqlCommandBuilder(pointAdapter);
        pointAdapter.Fill(ds);
        Session["UserDS"] = ds;


And here's what I'm trying to do in a different page:

dataset = (DataSet)Session["UserDS"];
// ... do some stuff to rows
using (SqlConnection connection = new SqlConnection(connStr))
{
    try
    {
        SqlDataAdapter pointAdapter = (SqlDataAdapter)Session["pointAdapter"];
        pointAdapter.Update(dataset, "UserPoints");


With this code I get a "connection string uninitialized" error. But I've gotten several different errors, enough to convince me I'm going about this the hard way. Is there a standard pattern for this sort of thing, or a tutorial someone can point me to?
AnswerRe: how to update dataset after session cache? Pin
Igor Sukhov9-Jul-06 0:24
Igor Sukhov9-Jul-06 0:24 
GeneralRe: how to update dataset after session cache? Pin
Ed 5410-Jul-06 8:35
Ed 5410-Jul-06 8:35 
QuestionAbout DataType in the access Pin
KSCsoft8-Jul-06 5:04
KSCsoft8-Jul-06 5:04 
AnswerRe: About DataType in the access Pin
Rob Graham8-Jul-06 5:27
Rob Graham8-Jul-06 5:27 
Questiontransaction Pin
md_refay8-Jul-06 3:27
md_refay8-Jul-06 3:27 
AnswerRe: transaction Pin
Rob Graham8-Jul-06 5:28
Rob Graham8-Jul-06 5:28 
QuestionGroup By Question Pin
Chris McGlothen7-Jul-06 12:03
Chris McGlothen7-Jul-06 12:03 
AnswerRe: Group By Question Pin
Asif Sayed7-Jul-06 17:33
Asif Sayed7-Jul-06 17:33 
GeneralRe: Group By Question Pin
Chris McGlothen10-Jul-06 4:26
Chris McGlothen10-Jul-06 4:26 
AnswerRe: Group By Question Pin
Colin Angus Mackay7-Jul-06 23:22
Colin Angus Mackay7-Jul-06 23:22 
GeneralRe: Group By Question Pin
Chris McGlothen10-Jul-06 4:23
Chris McGlothen10-Jul-06 4:23 
QuestionSQL database administration levels Pin
GETEL - General Telecom7-Jul-06 9:24
GETEL - General Telecom7-Jul-06 9:24 
AnswerRe: SQL database administration levels Pin
Colin Angus Mackay7-Jul-06 9:47
Colin Angus Mackay7-Jul-06 9:47 
GeneralRe: SQL database administration levels Pin
Paul Conrad7-Jul-06 14:39
professionalPaul Conrad7-Jul-06 14:39 
GeneralRe: SQL database administration levels Pin
Colin Angus Mackay7-Jul-06 23:16
Colin Angus Mackay7-Jul-06 23:16 
QuestionField in multiple tables Pin
VK-Cadec7-Jul-06 9:02
VK-Cadec7-Jul-06 9:02 
AnswerRe: Field in multiple tables Pin
Colin Angus Mackay7-Jul-06 9:43
Colin Angus Mackay7-Jul-06 9:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.