Hi
I have the following hardcoded the following (only the relevant code is
shown),
to populate a datagrid. The data loads into the grid as expected
private void LoadData()
{
//THIS CODE WORKS FINE - within this eventhandler
and the dataset and dataadapter are availible in the intellisense
// Dataset dsModify = New Dataset();
// SqlDataAdapter daModify = new SqlDataAdapter( );
}
private void btnModify_Click (object sender, System.EventArg s e)
{
//Accept user changes
// PROBLEM - the dsModify and daModify are not availible in intellisense
to allow modifications to be pushed through to the database
// Errors generated are :
1) The type or namespace daModify could not be found
are you missing a using directive or an assembly reference"
2) The name dsModify does not exist in the <class>.<form >
}
I have attempted to put the following code into the public class of the form
private System.Data.Sql Client.SqlDataA dapter daModify
and get an error saying that daModify is never used - however it is used in
LoadData()
Any assistance would be appreciated
Thanks
Christopher 2 4243
Christopher <Ch*********@di scussions.micro soft.com> wrote: I have the following hardcoded the following (only the relevant code is shown), to populate a datagrid. The data loads into the grid as expected
private void LoadData() { //THIS CODE WORKS FINE - within this eventhandler and the dataset and dataadapter are availible in the intellisense
// Dataset dsModify = New Dataset();
// SqlDataAdapter daModify = new SqlDataAdapter( ); }
private void btnModify_Click (object sender, System.EventArg s e) { //Accept user changes
// PROBLEM - the dsModify and daModify are not availible in intellisense to allow modifications to be pushed through to the database
// Errors generated are :
1) The type or namespace daModify could not be found are you missing a using directive or an assembly reference" 2) The name dsModify does not exist in the <class>.<form > }
I have attempted to put the following code into the public class of the form
private System.Data.Sql Client.SqlDataA dapter daModify
and get an error saying that daModify is never used - however it is used in LoadData()
Could you post a short but complete program which demonstrates the
problem?
See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
You need to change this line
//SqlDataAdapter daModify = new SqlDataAdapter( );
to
this.daModify = new SqlDataAdapter( );
and also you need to add this line to the class declaration
private System.Data.Dat aset dsModify;
and change this line
//DataSet dsModify = new Dataset ();
to
this.dsModify = new Dataset();
--
Sijin Joseph http://www.indiangeek.net http://weblogs.asp.net/sjoseph
"Christophe r" <Ch*********@di scussions.micro soft.com> wrote in message
news:77******** *************** ***********@mic rosoft.com... Hi
I have the following hardcoded the following (only the relevant code is shown), to populate a datagrid. The data loads into the grid as expected private void LoadData() {
//THIS CODE WORKS FINE - within this eventhandler and the dataset and dataadapter are availible in the intellisense
// Dataset dsModify = New Dataset();
// SqlDataAdapter daModify = new SqlDataAdapter( ); }
private void btnModify_Click (object sender, System.EventArg s e) { //Accept user changes
// PROBLEM - the dsModify and daModify are not availible in intellisense to allow modifications to be pushed through to the database
// Errors generated are :
1) The type or namespace daModify could not be found are you missing a using directive or an assembly reference" 2) The name dsModify does not exist in the <class>.<form > }
I have attempted to put the following code into the public class of the
form private System.Data.Sql Client.SqlDataA dapter daModify
and get an error saying that daModify is never used - however it is used
in LoadData()
Any assistance would be appreciated
Thanks
Christopher This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mojtaba Faridzad |
last post by:
Hi,
Please check these lines:
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet, "mytable");
DataRow row;
row = dataSet.Tables.Rows;
row.BeginEdit();
row = "555";
|
by: JacksonYin |
last post by:
1. I can fill data from Excel to DataSet like this:
OleDbConnection connection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=../../Book1.xls;Extended Properties=Excel 8.0;");
connection.Open();
OleDbCommand command =new OleDbCommand("SELECT * FROM myRange1",
connection);
|
by: JIM.H. |
last post by:
Hello,
Can I send a dataset as a parameter into stored procedure and import data to
a table in the stored procedure?
Thanks,
Jim.
|
by: Dave Taylor |
last post by:
I've been using the dataset designer in Visual Studio to create typed
datasets for my application by dragging over tables from the Server Explorer
and dropping them into the designer. The problem is, when I modify these
tables in SQL Server (typically adding fields and what not), there doesnt
seem to be an easy way to update the typed dataset. If I delete the
previous table definition and drop a new one on, all of the relationships
are...
|
by: Graham Blandford |
last post by:
Hi all,
Would someone be able to tell me the most 'graceful' way of removing
unwanted rows from a dataset based on a condition prior to update? OR,
resetting the rows all to unchanged after they are initally added to the
recordset.
I create a dataset, which begins empty after the initial .Fill.
Then I create several rows with some default information, leaving one
| |
by: chreo |
last post by:
I GIVE UP...I can't refresh datagrid (dataset)
I have datagrid = dgrPaczki
Datasource of that datagrid = DataSetPaczki1.PACZKI_PAKOWALNIA (forgive me Polish words)
Dataadapter which fills my DataSetPaczki1 = adaPaczki
Dataadapter selects rows returned by user defined function = PACZKI_Z_AKCJI
To select rows from that function it uses sqlCommand = comPaczki
I will explain how it works:
|
by: Robert Bravery |
last post by:
Hi All,
I'm New to VS.net. Trying to figure out this new dataset thingy.
Ok so I add a dataadapter with all the correct properties for a table. Then
generate the dataset. Now open the dataset and drag another table from the
server explorer, set up some relations there. Set up two grids, one a s a
parent one as a chgild. Fill the dataset, run the form
But my child grid never gets any records.
I then added another datadapter for the child...
|
by: davefromalbury |
last post by:
I have a gridview connected to a objectdatasource. Can't for the life
of me get it to display anything though, always appears empty. The
dataset always seems to be filled with records, as the variable "x"
always equals the number of records i expected. The business object
select command:
public static DataSet Select()
{
DataSet dataSet = new DataSet();
SqlDataAdapter dataAdapter = new SqlDataAdapter();
|
by: David P. Donahue |
last post by:
My experience with databases using C# has been pretty limited thus far.
Mostly I just use a SELECT statement to populate a DataSet, which is
just read-only (mostly for display on a web page), or maybe go so far as
to build an UPDATE or INSERT query with a couple parameters and just
execute it against the database. Currently, this is all done within a
web service, which acts as a kind of protective barrier between the
actual database and...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |