Data menu for Data Adapters

Visual Studio .Net

    Next

  • 1. vs2005: can't remove setup project dependency
    In a setup project I want to delete some dependencies on Microsoft.SqlServer... since I no longer have any references to it anywhere in the project. I can't delete the dependency. I can only "exclude" a dependency. Why am I not seeing a delete menu item?
  • 2. Adding Icons to VS2005 Exe's and Shortcuts
    Is there a HowTo for doing this? I have a solution with six projects in it, each generating an Exe. My MSI puts entries in the start menu. I've managed to get Icons on each shortcut, but I'm having trouble with the main forms and taskbar. Some of my programs put their icons on the task bar and others don't. Some show icons on the form some don't. The parameters that control this are spread out across a variety of property sheets (project, form, and deployment, so I'm sure I'm missing the differences, but they have to be there somewhere. I think that part of the problem relates to 16x16 and 32x32 icons. The icon editor seems to only show one of the icons that are in the icon file. On a scale of 1 to ten, this isn't a big deal, but it is a little embarassing when my customer comments on it. Thx Marc
  • 3. Suggestion: View.NextError improvement
    I'm not sure where to report suggestions, so I'll start here. If anyone knows, please let me know. The Visual Studio View.NextError command often doesn't do anything, even after a build failure. I assume it is because I'm not on a "current" error, so there would be no "next". It would be much more useful if NextError always started at the first error after a build failure. Perhaps I am doing something wrong?
  • 4. How to disconnect a solution from sourcesafe control?
    I'm getting files of a solution from sourcesafe. I want that solution not to have source control when I'm using it in VS2005.

Data menu for Data Adapters

Postby arul » Sun, 12 Oct 2003 02:32:57 GMT

We have implemented a custom DataAdapter. When an MS DataAdapter (Sql,
OleDB, etc.) is added to a Form, the Data menu options "Genereate
Dataset..." and Preview Data..." options become available for the form.
These tools support the Microsoft Data Adapters as well as third party
DataAdapters (that is custom adapters appear in the dialogs and behave
correctly with the tools). However, the menu options are not enabled if ONLY
my custom DataAdapter is added to the form. What is the key to getting these
tools enabled for custom data adapters?



RE: Data menu for Data Adapters

Postby timhuang » Wed, 15 Oct 2003 00:17:04 GMT

Hi,

Thanks for your post.

Based on my experience and research, the Data menu was implemented by the 
Attributes from the System.ComponentModel namespace that allow a designer 
to be specified for a class or property. Please look at the SqlDataAdapter 
class declaration to find the values of this attribute:

//-----------------------SqlDataAdapter -------------------------
.class public auto ansi sealed beforefieldinit SqlDataAdapter
extends System.Data.Common.DbDataAdapter
implements System.Data.IDbDataAdapter,
   System.Data.IDataAdapter
{
.custom instance void [System]
System.ComponentModel.
DesignerAttribute::.ctor(string) = 
"Microsoft.VSDesigner.Data.VS.
 SqlDataAdapterDesigner, Microsoft.VSDesigner"
 [System]
System.ComponentModel.
ToolboxItemAttribute::.ctor(string) = 
"Microsoft.VSDesigner.Data.VS.
sqldataAdapterToolboxItem,
Microsoft.VSDesigner
//--------------------------end of----------------------------------

This tells you that the designer for the SqlDataAdapter class is located in 
the Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner class, in the 
Microsoft.VSDesigner assembly. I am afraid that you cannot use Microsoft 
designer classes and you may have to make your own designer and editors.

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


RE: Data menu for Data Adapters

Postby arul » Wed, 15 Oct 2003 05:11:59 GMT

I certainly agree in priciple with what you are saying, 
and I would certainly agree that we must implement our own 
designer for configuration (and I am working on that), it 
appears to me that the "Genereate Dataset..." and Preview 
Data..." options are seperate from the designer. 

I say this because those two items are present in the Data 
menu AT ALL TIMES and not just when a data adapter is 
added to a form. They appear in the menu ABOVE the 
seperator where designer verbs are listed. Further, these 
menu items are active not just for the data adapter, but 
for the form itself when an MS data adapter is present. 

This doesn't seem to fit with what I know of component 
designers. I was speculating that these two particular 
actions were being handled through a different attribute 
or mechanism altogether. I was hoping that you might be 
able to follow up and confirm whether that is the case or 
if you could explain this atypical behavior.

Thanks!

implemented by the 
allow a designer 
the SqlDataAdapter 
-------
SqlDataAdapter
----------
class is located in 
class, in the 
cannot use Microsoft 
designer and editors.
confers no rights.

RE: Data menu for Data Adapters

Postby johnei » Fri, 17 Oct 2003 08:55:56 GMT

i, Arul

I discussed your issue with a techlead in the database group. She said
that they would need to escalate to the product team to get you your
answer, one way or the other. It may be a design limitation, but we will
need to wait for word from the devs before we know for sure.

Thank you for your patience, and for choosing the MSDN Managed Newsgroups,

John Eikanger
Microsoft Developer Support

This posting is provided S ISwith no warranties, and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From:<< XXXX@XXXXX.COM >>
| Sender:<< XXXX@XXXXX.COM >>
| References:<< XXXX@XXXXX.COM >> << XXXX@XXXXX.COM >>
| Subject: RE: Data menu for Data Adapters
| Date: Mon, 13 Oct 2003 13:11:59 -0700
| Lines: 80
| Message-ID:<<162201c391c6$42311190$ XXXX@XXXXX.COM >>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcORxkIxxvPLYYOjQcS7hJwXbDvPjw==
| Newsgroups: microsoft.public.vsnet.ide
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.vsnet.ide:8686
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.public.vsnet.ide
|
| I certainly agree in priciple with what you are saying,
| and I would certainly agree that we must implement our own
| designer for configuration (and I am working on that), it
| appears to me that the "Genereate Dataset..." and Preview
| Data..." options are seperate from the designer.
|
| I say this because those two items are present in the Data
| menu AT ALL TIMES and not just when a data adapter is
| added to a form. They appear in the menu ABOVE the
| seperator where designer verbs are listed. Further, these
| menu items are active not just for the data adapter, but
| for the form itself when an MS data adapter is present.
|
| This doesn't seem to fit with what I know of component
| designers. I was speculating that these two particular
| actions were being handled through a different attribute
| or mechanism altogether. I was hoping that you might be
| able to follow up and confirm whether that is the case or
| if you could explain this atypical behavior.
|
| Thanks!
|
|>>-----Original Message-----
|>>Hi,
|>>
|>>Thanks for your post.
|>>
|>>Based on my experience and research, the Data menu was
| implemented by the
|>>Attributes from the System.ComponentModel namespace that
| allow a designer
|>>to be specified for a class or property. Please look at
| the SqlDataAdapter
|>>class declaration to find the values of this attribute:
|>>
|>>//-----------------------SqlDataAdapter ------------------
| -------
|>>.class public auto ansi sealed beforefieldinit
| SqlDataAdapter
|>>extends System.Data.Common.DbDataAdapter
|>>implements System.Data.IDbDataAdapter,
|>> System.Data.IDataAdapter
|>>{
|>>.custom instance void [System]
|>>System.ComponentModel.
|>>DesignerAttribute::.ctor(string) =
|>>"Microsoft.VSDesigner.Data.VS.
|>> SqlDataAdapterDesigner, Microsoft.VSDesigner"
|>> [System]
|>>System.ComponentModel.
|>>ToolboxItemAttribute::.ctor(string) =
|>>"Microsoft.VSDesigner.Data.VS.
|>>sqldataAdapterToolboxItem,
|>>Microsoft.VSDesigner
|

RE: Data menu for Data Adapters

Postby sparra » Sat, 18 Oct 2003 04:36:34 GMT

i Arul,

I'm the database tech lead that John Eikanger referred to in his post from
yesterday. I did some investigation on this issue, and got confirmation
that this behavior is by design with the current version of the IDE. The
"Generate Dataset" and "Preview Data" options are currently only enabled
for providers that we have tested, which would be only the providers
shipped by Microsoft. This includes the .NET Data Providers shipped by
Microsoft, and with the OleDbDataAdapter, the native OLE DB providers
shipped by us.

I know this has come up before, and I think we filed a request to get this
functionality added in a future version. If not, I'll make sure that it
gets filed now. I can't promise that this will happen, but I can at least
get it logged with the development team.

Thanks!
Sarah Parra
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Strategic Technology Protection
Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.

--------------------
< XXXX@XXXXX.COM >


Similar Threads:

1.Data Adapters, Data Sets, Data TableMappings, and XML

Here's what I'm trying to do:

1. Create a data adapter with Select and Insert commands.

2. Use DataTableMappings to map XML tags into columns in a 
data base table.

3. Create a dataset

3. Read in a schema using dataset.ReadXmLSchema

4. Read in an xml file that contains the data using 
dataset.Read XML

5. Add 3 new columns to the dataset. (These columns have 
already been mapped in step 2).

6. Put data in the 3 new columns.

7. Modify some data in the other columns using xpath 
queries to find the nodes that need changing.

8. Use datadapter.update(dataset, tablename)

Everything seems to work fine until step 8. I get all the 
data, the extra columns get added, and the data in other 
columns gets modified. When I execute step 8 I get:

Run-time exception thrown : 
System.InvalidOperationException - Cannot add or remove 
columns from the table once the DataSet is mapped to a 
loaded XML document.

Any ideas about how I can either fix this or do it another 
way.

TIA,
Candi

2.problem with data adapter and data set while inserting and retrieving data

i am using a data adapter and a dataset for filling and retrieving data
into .mdb database.
following is the code.....

for the form load event
  Dim dc(0) As DataColumn
        Try
            If OleDbConnection1.State = ConnectionState.Closed Then
                OleDbConnection1.Open()
            Else
                MsgBox("connection can not be established")
            End If
            DA.Fill(DataSet11, "Table1")
            cmd = New OleDbCommandBuilder(DA)
            dc(0) = DataSet11.Tables("Table1").Columns("EmpID")
            DataSet11.Tables("Table1").PrimaryKey = dc
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Delete.Enabled = False
    End Sub

for  inserting values into the DB

Private Sub Insert_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Insert.Click
        Dim dr As DataRow
        dr = DataSet11.Tables("Table1").NewRow
        dr.Item(0) = Val(TB1.Text)
        dr.Item(1) = TB2.Text
        dr.Item(2) = TB3.Text
        dr.Item(3) = Val(TB4.Text)
        dr.Item(4) = TB5.Text
        DataSet11.Tables("Table1").Rows.Add(dr)
        DA.Update(DataSet11, "Table1")
        MsgBox("data is saved")
        rno = 0
        call filldata()

filldata function consists of the following

 With DataSet11.Tables("Table1").Rows(rno)
         TB1.Text = Trim(.Item(0))
         TB2.Text = Trim(.Item(1))
         TB3.Text = Trim(.Item(2))
         TB5.Text = Trim(.Item(4))
         End With

the error it gives is " there is no row at
0........system.nullreference...........i checked the connection and
its working fine and also the database is getting accessed........the
error is occuring at the line " With
DataSet11.Tables("Table1").Rows(rno) "

3.Provider independent data access: creating a data adapter from a connection

I have written a provider independent ado.net utility class for 
executing queries. One of the routines looked like this in .net 1.1:

static public DataSet ExecuteQuery(IDbConnection connection, String sql)
{
   connection.Open();

   DataSet result  = new DataSet();
   IDbDataAdapter adapter = /* magic to create an adapter from a 
connection*/

   // The sybase adapter's implement IDisposable, so wrap with a using. 

   using(adapter as IDisposable)
   {
     adapter.SelectCommand.CommandText = sql;
     adapter.SelectCommand.Connection = conn;
     adapter.Fill(result);
   }

   return result;
}

The magic code to create the adapter was ugly: it essentially performed 
a dictionary lookup on the type of connection, and created the resulting 
adapter type. If IDbConnection had a method called CreateAdapter, 
analagous to CreateCommand, this would have been cleaner.

With the introduction of ADO.NET 2.0 and the DbProviderFactory class, I 
was hoping that some of the ugliness would go away. Unfortunately, I am 
running into some problems. Namely

1- DbConnection still does not have a CreateAdapter method

2- DbConnection does not offer a way to get back to the 
DbProviderFactory that created it.

So I still cannot create the correct adapter given only a generic 
DbConnection. I am looking for suggestions on how to code my routine. So 
far, I have thought of these

1- Make the user pass in the DbProviderFactory that goes with the 
connection. CONS: forces users to use DBProviderFactory. We have a lot 
of code that doesn't.

2- Stick with the dictionary lookup (Dictionary<ConnType, AdapterType>. 
CONS: DLL dependencies explode.

3- Use a different dictionary lookup (Dictionary<ConnType, 
DBProviderFactory>. CONS : A little messy, but better than 2.

4- Don't use provider specific adapters at all, just use a generic one. 
Like this:

class GenericAdapter : System.Data.Common.DbDataAdapter
{
}

static public DataSet ExecuteQuery(DbConnection connection, String sql)
{
   connection.Open();

   DataSet result  = new DataSet();
   GenericAdapter adapter = new GenericAdapter();
   adapter.SelectCommand = conn.CreateCommand();
   adapter.SelectCommand.CommandText = sql;
   adapter.Fill(result);
   return result;
}

I have tested this with two databases, Sybase ASE and ASA, and it seems 
to work. Are there any serious downfalls to not using the vendor 
specific adapter type? Is this code safe?

H^2

4.Passing parameter for Stored Procedure to Data Adapter/Data Se

5.Passing parameter for Stored Procedure to Data Adapter/Data Set

Hey all,

   I'm trying to pass a parameter into my Stored procedure to be accessed by 
my data adapter into a dataset

            db2.AddParameter("@intClientID", 
cmbClientList.SelectedValue.ToString());
            DataSet rsDataset = db2.Fill("spListMappingDetails", 
CommandType.StoredProcedure);

However, when i try to run it, it gives me an error 

{"Procedure 'spListMappingDetails' expects parameter '@intClientId', which 
was not supplied."}

Any help is appreciated.

I used a executescalar and executequery function and it has no problem. 

thanks in advance

6. Manipulating data between data adapters

7. How to change data in grid after you change the SQL select for the data adapter

8. 3rd Tier data not displaying in Data Adapter Preview



Return to Visual Studio .Net

 

Who is online

Users browsing this forum: No registered users and 31 guest