Newbee: Help on child-parent relation and binding to Forms
Hello,
i'm a newbee to ADO.Net. I need to create a Form that contains values of a
Childtable 'artikel' and the corresponding value of the field
'lieferant.firma' which connects through a FL-constraint to the table
'lieferant'.
I tried to bind the realtion lieferantartiekel as the datamember to the
Combobox. Doesn't work.
Is there any hint how to solve this problem ?
Thanks a lot.
Thomas Tag: data access block for ADo.NET 2.0 Tag: 122911
Deleting a bound DataGridView row?
I have a DataGridView which is bound to a dataset.
When I delete rows from the DataGridView, should it delete the same rows
from the dataset also?
I have tried the following code, but apparently, the dataset isn't
updated. Did I miss (understood) something?
for(int i = 0; i < dataGridView.SelectedRows.Count; i++)
{
DataGridViewRow row = dataGridView.SelectedRows[i];
dataGridView.Rows.Remove(row);
}
Debug.WriteLine(myTypedDataset.myTypedDataTable.Rows.Count.ToString());
// Here, the count is the same as before the deletion, but when
// accessing the dataTable rows, a
// DeletedRowInaccessibleException occurs on the deleted rows Tag: data access block for ADo.NET 2.0 Tag: 122910
Connect to Foxpro Data (*.DBF) in VB.Net
Dear All
We are currently write a program to "Transfer" Data from old system.
How can i connect to a set of DBF files by
What is the connection string to connect the DBF?
I have try this one but error.
connstr = "Provider = VFPOLEDB;Data Source=" & "C:\ESS2001\DATA\"
I have the following question?
1. Does [OleDBConnection] Object support DBF Files? or i should use
[ODBCConnection] ?
2. Should I it a must to have a "*.dbc" file ?
3. I need to use ADO instead of ADO.Net in VB.Net ?
Thank you for your help in advance!
--
EricLun Tag: data access block for ADo.NET 2.0 Tag: 122902
Use ADO.NET to keep data between client and server in sync
Hi,
my server has a database table. I read this table on the server into a
dataset and my client retrieves it through a webservice.
No changes on the client and server happen. What's the best way to keep the
data in sync?
I want to avoid that I transfer the entire dataset all the time. Is there
feature of ADO.NET which I can use to find changes and send just them?
Thanks for any hint
Anthony
--
Anthony Malt Tag: data access block for ADo.NET 2.0 Tag: 122900
Random 'Invalid Row Handle'
This is a multi-part message in MIME format.
------=_NextPart_000_0203_01C61032.6F29FDF0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello,
I am facing a weird problem using the DataReader.
This is what my code looks like.
---------------
Dim dbCommand As OleDbCommand
Dim dReader As OleDbDataReader
dbCommand =3D New OleDbCommand("SELECT * FROM CmpDet where =
cmpDet_CompanyID =3D " & CurrentCompany.CompanyID, DBCompany)
dReader =3D dbCommand.ExecuteReader 'Retrieve info from the database
dReader.Read() 'Read the record
'Load the company details
Try
CurrentCompany.Address =3D dReader.Item("cmpDet_MailAddress")
CurrentCompany.CompanyName =3D dReader.Item("cmpDet_CompanyName")
CurrentCompany.City =3D dReader.Item("cmpDet_CityName")
CurrentCompany.State =3D dReader.Item("cmpDet_State")
Catch ex As Exception
MsgBox(ex.Message)
Stop
End Try
'Empty the objects
dReader.Close()
dbCommand.Dispose()
dReader =3D Nothing
dbCommand =3D Nothing
---------------------
My problem is that on the dReader.item("cmpDet_MailAddress") line (When =
I try to read the contents of the dReader object). I sometimes get an =
error 'Invalid Row Handler'=20
This error does not occur all of the time, only some of it. Could it be =
because the records that the dReader retrieves were added to the db in a =
line just above this code block? I am using a dbCommand object with an =
"INSERT INTO" query to add the contents to the DB so I expect that there =
should be no problems retrieving data.
This error only occurs some of the time, and at other times it runs =
fine.
Any clues why this could be happening?
Thanks
Cyril Gupta
------=_NextPart_000_0203_01C61032.6F29FDF0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DVerdana size=3D2>Hello,</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2>I am facing a weird problem using the =
DataReader.</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2>This is what my code looks =
like.</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2>---------------<BR></FONT><FONT =
face=3DVerdana=20
size=3D2>Dim dbCommand As OleDbCommand<BR>Dim dReader As=20
OleDbDataReader</FONT></DIV>
<DIV>
<P><FONT face=3DVerdana size=3D2>dbCommand =3D New OleDbCommand("SELECT =
* FROM CmpDet=20
where cmpDet_CompanyID =3D " & CurrentCompany.CompanyID, =
DBCompany)<BR>dReader=20
=3D dbCommand.ExecuteReader 'Retrieve info from the =
database<BR>dReader.Read()=20
'Read the record</FONT></P>
<P><FONT face=3DVerdana size=3D2>'Load the company=20
details<BR>Try<BR> CurrentCompany.Address =3D=20
dReader.Item("cmpDet_MailAddress")<BR> CurrentCompany.CompanyName =
=3D=20
dReader.Item("cmpDet_CompanyName")<BR> CurrentCompany.City =3D=20
dReader.Item("cmpDet_CityName")<BR> CurrentCompany.State =3D=20
dReader.Item("cmpDet_State")<BR>Catch ex As=20
Exception<BR> MsgBox(ex.Message)<BR> Stop<BR>End =
Try</FONT></P>
<P><FONT face=3DVerdana size=3D2>'Empty the objects</FONT></P>
<P><FONT face=3DVerdana =
size=3D2>dReader.Close()<BR>dbCommand.Dispose()<BR>dReader =3D=20
Nothing<BR>dbCommand =3D Nothing</FONT></P>
<P><FONT size=3D2><FONT =
face=3DVerdana>---------------------</FONT></FONT></P>
<P><FONT face=3DVerdana size=3D2>My problem is that on the=20
dReader.item("cmpDet_MailAddress") line (When I try to read the contents =
of the=20
dReader object). I sometimes get an error 'Invalid Row Handler' =
</FONT></P>
<P><FONT face=3DVerdana size=3D2>This error does not occur all of the =
time, only=20
some of it. Could it be because the records that the dReader retrieves =
were=20
added to the db in a line just above this code block? I am using a =
dbCommand=20
object with an "INSERT INTO" query to add the contents to the DB so I =
expect=20
that there should be no problems retrieving data.</FONT></P>
<P><FONT face=3DVerdana size=3D2>This error only occurs some of the =
time, and at=20
other times it runs fine.</FONT></P>
<P><FONT face=3DVerdana size=3D2>Any clues why this could be =
happening?</FONT></P>
<P><FONT face=3DVerdana size=3D2>Thanks<BR>Cyril=20
Gupta</FONT></P></DIV></BODY></HTML>
------=_NextPart_000_0203_01C61032.6F29FDF0-- Tag: data access block for ADo.NET 2.0 Tag: 122887
SQL Server Starting Points
Greetings -
Several of you were helpful in disuading me from using Jet in a prior post.
I'm developing an application that needs a "person manager" attached to it,
with typical interfaces like "add person" "edit person" "get list of people"
plus some custom items.
A few questions.
I'm experienced in relational database design, access and .net, but not at
all in sql server:
1. How steep is the learning curve on SQL Server?
2. Any suggestions for good materials on getting started (most of the
documentation looks geared to those who are proficient with prior versions)
3. Any suggestions for how I can find a third party to get me started on
this -- most of the solution providers listed online seem to be looking to do
large turnkey packages. I'd be looking more for some part time development
and mentoring consulting to get this launched and then back in my hands. Any
ideas where I can find this (I'm just outside of NYC, fwiw).
Thanks for any pointers/suggestions!
kc Tag: data access block for ADo.NET 2.0 Tag: 122883
Copy just some rows from a datatable to another datatable.
I have a datatable with a field in it that tells me where the data belongs
(let's say the values are 'A' and 'B'). I want to split the table into two
other tables where in one there are only the 'A' records and the other one
has only the 'B' records.
What's the easiest way to do it? I looked at a dataview but it has no copy,
it has copyto.
TIA - Jeff. Tag: data access block for ADo.NET 2.0 Tag: 122870
DataSet.Clear required before loading new data?
Is a DataSet.Clear required before new data is brought into the dataset?
I.E. daMyDataset.Fill(dsMyDataset)
Can I simply refill the dataset with new data intended to totally replace
the old data, or must I do a .Clear first?
Thanks
Rick Lederman Tag: data access block for ADo.NET 2.0 Tag: 122869
2nd layer of filtering?
I have a paramaterized command for a data adapter
SELECT MRN, Name, Sex, DOB, SSN
FROM dbo.Membership
WHERE (MRN = @MRN or @MRN is null)
AND (Name like @Name or @Name is null)
AND (Sex = @Sex or @Sex is null)
etc.
The name of that result set is from a stored procedure called:
qMembershipSelect
for 1.4 million records, this ensures that the data will come up quickly
because all I'm doing is filtering between 1-4 parameters.
But after the first select is done, I'd like to apply additional filtering
to that result set
that weeds out other stuff like duplicate records and selects a true Current
member:
SELECT DISTINCT MRN, MemNAME AS Member, DOB, SEX, SSN, GROUP, SGR,
[FROM-DT], [THRU-DT]
FROM qMembershipSelect AS Y
GROUP BY MRN, MemNAME, DOB, SEX, SSN, GROUP, SGR, [FROM-DT], [THRU-DT]
HAVING [THRU-DT] Is Null Or [THRU-DT] In (Select Max(X.[Thru-Dt]) From
qMembershipSelect As X Where X.MRN = Y.MRN And X.MRN Not in(Select Z.MRN
From qMembershipSelect As Z Where Z.[THRU-DT] Is Null))
ORDER BY MemNAME, [FROM-DT] DESC;
Obviously this 2nd layer of filtering wouldn't be so tedious to a smaller
dataset as it would to 1.4 million records at the start.
Are you able to do this in ADO.NET with a DataTable?... if not, how do you
go about it?
In DAO, what I would do is write the First Select Statement
qdf.SQL = "Select...."
That would become qMembershipSelect
and then refer to the rewritten query as if it were a table.
it would be nice if qMembershipSelect could be referred to with this
complexity with another dataadapter?
I don't see in ADO.NET being able to write complex SQL statements that refer
to a DataTable (equivalent to a query in Access)? Tag: data access block for ADo.NET 2.0 Tag: 122842
Dataadapter produces error: Syntax error in INSERT INTO statement
The code below loads an Access table with one row. It then adds a row and
displays all this in a datagridview. So far so good.
But when I use the dataadapter's update command to update the database
table, I receive the following error:
Syntax error in INSERT INTO statement
The Insert statement as displayed by the debug,write line is:
INSERT INTO Main (Id, Interval, Tutor1, Tutor2) VALUES (?, ?, ?, ?), which
looks fine to me.
Where is the problem? The Commandbuilder should have no problems with this
simple setup.
The code:
Dim ds2 As New DataSet
Dim da2 As New Data.OleDb.OleDbDataAdapter
Dim dc As Data.OleDb.OleDbConnection = New OleDb.OleDbConnection
dc.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=Test2.mdb"
dc.Open()
Dim StrSQL As String = "SELECT * from Main"
Dim objCommand As New Data.OleDb.OleDbCommand(StrSQL, dc)
da2.SelectCommand = objCommand
Dim CB2 As Data.OleDb.OleDbCommandBuilder = New
OleDb.OleDbCommandBuilder(da2)
Debug.Write("CB: " & CB2.GetInsertCommand.CommandText) 'What it
writes looks fine to me
da2.Fill(ds2, "Main")
Dim NewRow As DataRow = ds2.Tables(0).NewRow
NewRow.Item("ID") = 254
NewRow.Item("Interval") = 22
NewRow.Item("Tutor1") = "Joe"
NewRow.Item("Tutor2") = "Mary"
ds2.Tables(0).Rows.Add(NewRow)
Me.DataGridView1.DataSource = ds2.Tables(0)
MsgBox("Got this far")
da2.Update(ds2, "Main") 'Here is where the error occurs. Tag: data access block for ADo.NET 2.0 Tag: 122841
Code reuse and DataSet generation from XML schema
Hello,
I have several strongly typed DataSet classes that encapsulate the same
table. My challenge is that I can't reuse the wrapper code for this table
generated by Visual Studio, because although wrapper classes represent
identical structures, they have different identities.
If I have two strongly typed DataSets (DataSet1 and DataSet2) and both of
them wrap a table MyTable, VisualStudio duplicate the code in .cs files,
i.e. I get DataSet1.MyTableRow class and DataSet2.MyTableRow, so it is not
possible to have a common method DoSomethingWithMyTableRow(MyTableRow row) -
I have two different identities for MyTable row structures.
Does anyone know an approach for code reuse in such cases?
Thanks in advance
Vagif Abilov
Oslo Norway Tag: data access block for ADo.NET 2.0 Tag: 122839
Problem connecting to sql server
Hi,
I am using XP Pro SP2, VS.NET 2003 & IIS 5. I used to develop an ASP.NET
application on my PC on my local IIS, connecting to a LAN server which hosts
my MSSQL database. I have no problem running the web app locally.
After I reformat and reinstall XP, I could not run the app anymore. The app
could not find the SQL server. But I can connect to the server via
Enterprise Manager installed locally and browse the tables. And I can even
ping the server.
I have tried using both IP and servername but to no avail. However, my
machine can connect when I tried using normal windows application, using the
same connection string.
I think I am missing something bcos I used to have the same problem last
time. But I forgot what is needed to be done on my machine to make it work. Tag: data access block for ADo.NET 2.0 Tag: 122825
use sql mdf from application folder
Hi,
I need to deploy my simple windows application to client's pc so that
the database it requires is packaged along with it in the application
folder. I have done it through the setup project but after installation
it throws exception of being unable to acess the database. Please note
that the client does not need to have SQL server installed. I have MS
SQL Server Express and Developer Edition both installed on my m/c. I am
using SQLEXPRESS for database connection strin in my project.
My question is, does the client need to have SQL server installed on
their system?
TIA. Tag: data access block for ADo.NET 2.0 Tag: 122821
I'd like to programatically move through a table
I'd like to programatically move through a table (call it a recordset in
ADO ) and disply fields in a textbox. I've gotten as far as the code below
(which just loads a listbox) I assume I need to work with the dataadaptor ,
but have been unable to find info on the web as to how to do it - the hope
is to be able to work , record by record,; something like the .movenext
capacity in the recordset objects of DAO and ADO.
myConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\t.mdb")
myConnection.Open()
'myCommand = New OleDbCommand("select * from main", myConnection)
Dim myDataAdapter As New OleDb.OleDbDataAdapter( _
"Select * from main", myConnection)
Dim myDataSet As New DataSet()
myDataAdapter.Fill(myDataSet, "main")
'Dim myReader As OleDb.OleDbDataReader
Dim DataViewManager1 As DataViewManager = myDataSet.DefaultViewManager
ComboBox1.DataSource = DataViewManager1
ComboBox1.DisplayMember = "main.First" Tag: data access block for ADo.NET 2.0 Tag: 122820
Problem using diffgram
I'm use diffgarm xml (for update) which is sent with a schema with
sqlxmlcommand whith sqlxml version 3 sp3. This mechanizem used ALL the
parameters in the before xml as the parameters used in the where clause used
by update commands to the data base.
1. Is there a way to limit the parameters used by the where clause only to
spesific fields!!!?
When I tried to send a diffgram which only contains some of the nodes
deffined in the schema, the mechanizm automaticly fills the missing nodes
with nulls and an update will use them with where clause with the value null
change these nodes which were missing in before clause to null.
2. Is there a way only to send and change the sent data?
Thanks,
G. Tag: data access block for ADo.NET 2.0 Tag: 122816
Managing "Row ID" for Table Inserts
Using c# and Visual Studio 2003, I've begun to wonder whether I'm adding
rows to Oracle tables correctly. The tables often have "row ID" columns and,
before adding a row, I pull the "max" ID value from a table, add 1 to it,
and then use that number as the new "row ID" (the base table then gets
updated, so the dataset and table are not long out of sync). I'm sure this
approach is wrong, since, among other issues, the "max" ID returned could be
wrong if, for instance, a recently-added row was deleted. I don't know,
however, how else to do this. Should I instead use stored procedures? How
can I add rows to my dataset tables and know what "row ID" the underlying
table will expect during the row insert (especially with other users
potentially hitting the database)? Thanks for advice. Tag: data access block for ADo.NET 2.0 Tag: 122815
SqlCeResultSet, why not in ADO.NET?
I just discovered the SqlCeResultSet in the compact framework. It is more
like ADO or DAO than anything else that I have seen as far as coding in a VB
application goes. It appears to be very fast and efficient too! Is there
any plan to place the resultset in ADO.NET? It just seems FAR easier to
implement with fewer lines of code than creating a dataset.
Rick Lederman
www.soaringsoftware.com Tag: data access block for ADo.NET 2.0 Tag: 122812
History of Data Access
Hi,
I'm a novice programmer. When reading stuff on ADO.Net I often face terms
like OLE DB, ODBC. Is there anyone who knows the web links that can provide
me the concepts like these (ODBC,OLE DB and other concepts related to Data
Access) that can be understood easily by a novice like me. If anyone, please
give me those links.
Thanks in advance,
Regards,
Swat Tag: data access block for ADo.NET 2.0 Tag: 122790
Generate DataSet in 2.0?
I'm beginning to think Microsoft has spent the last few years revising .NET so as to break every single programming construct I've
developed. Sheesh!
Today, I'm trying to figure out where the Generate Dataset context menu option went in VS2005.
I used to build quick and dirty config files -- which I could access through a Dataset -- by creating an xml file with dummy data,
creating a schema from that xml file, converting the schema to a Dataset, and then selecting Generate Dataset. This created a
"hidden" file containing an autogenerated class which I could then read my xml config data into via ReadXml().
Unfortunately, the Generate Dataset menu option has disappeared. Or been moved. And I can't find it.
So how do I create a Dataset based on an existing xml file?
- Mark Tag: data access block for ADo.NET 2.0 Tag: 122788
Philosophical question: how often to submit updates to database
A concept I've waffled on from time-to-time with ADO.Net: how often to
submit updates back to the database. For example, I have some CF apps where
it's quite obvious the *when* part of submitting the update -- soon as you
come off of the record. For other desktop apps, it's not quite so obvious.
For example, I have a CRM app where there are dozens of fields for one
customer record, as well as many different datatables for sales,
appointments, etc.. So, I wonder: submit the update every time a single
change is made or submit it only when a different customer is selected? The
downside to the update for every single change is the obvious network/server
overhead; the downside for waiting on a customer change is what if the app
gets closed/crashes, etc? I'm not looking for a *right* answer here, just
some opinions. Thoughts, strategies, ideas from others would be appreciated. Tag: data access block for ADo.NET 2.0 Tag: 122775
Jet vs. Sql Server Express
Greetings -
I'm working on a new application and need to select a database for it. I
was wondering if anyone had any views on tradeoffs between going with
Jet/Access vs. SQL Server 2005 Express.
The database is going to sit on a server. I'm planning to implement .net
remoting from my client objects to a wrapper around the database, so the
database will be transparent to the distributed client apps.
I'll also access the database for ad hoc reporting and data manipulation.
I'm experienced with Access but haven't used SQL Server, so I would tend to
lean toward using Access/Jet. However, it seems most of the attention is on
SQL Server in everything I see about VS 2005.
Is Jet still getting attention?
What are the pros/cons of SQL Server vs. Jet?
Thanks for any help
kc Tag: data access block for ADo.NET 2.0 Tag: 122772
how do i connect to a remote database
i have a website that i use to file all my clients information, the go online
and they type the information. i'm using an microsoft access database. Now,
i want to create a windows application that i can run whenever a want to
transfer the new information that is on my website database to my local sql
server database. I just want to know how do i make a connection to the
database onlie using visual studio .net 2005 or if you have another option
please let me know.
Thanks. Tag: data access block for ADo.NET 2.0 Tag: 122771
exception on : ra = myCommand.ExecuteNonQuery()
(VB Exoress 20005)
I get an exception on this line : ra = myCommand.ExecuteNonQuery()
{"ExecuteNonQuery requires an open and available Connection. The
connection's current state is closed."}
in this code:
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand
Dim ra As Integer
myConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\t.mdb")
myCommand = New OleDbCommand("delete from main where last = 'freud'",
myConnection)
ra = myCommand.ExecuteNonQuery()
MessageBox.Show("Records Deleted" & ra)
myConnection.Close()
whereas this code works fine :
myConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\t.mdb")
myCommand = New OleDbCommand("select * from main", myConnection)
Dim myReader As OleDb.OleDbDataReader
myConnection.Open()
myReader = myCommand.ExecuteReader
Do Until myReader.Read = False
MessageBox.Show(myReader("last"))
Loop
myReader.Close()
myConnection.Close() Tag: data access block for ADo.NET 2.0 Tag: 122758
Books on ADO.NET 2.0?
I would like to get a good book on ADO.NET 2.0. I searched Amazon and
found 2 books that are rated well:
- Pro ADO.NET 2.0 (Expert's Voice)
- Programming Microsoft ADO.NET 2.0 Applications: Advanced Topics
However, I am looking to learn about the "new" way of working w/
data... TableAdapter, BindingSource, etc. From the descriptions of the
books, it kind of seems like these topics are not covered well, or at
all.
So my question is, what is a good ADO.NET 2.0 book that covers
TableAdapters, BindingSources, etc.?
Thanks!
John Tag: data access block for ADo.NET 2.0 Tag: 122754
dataset columns with system.dbnull
Hi everyone(happy new year!!),
Well, here we go... I have a problem with datsets, ado.net as i
understand ..I have a sp that in query analizer retrieve 13 columns and
the last 3 like the others have data, but when i see the dataset which
gets the data the last columns are system.dbnull, and here after
several tests, i am begging your help guys...did anyone have this
problem???? i ll be thankfull really for any help u can post...
Thanks in advance... Tag: data access block for ADo.NET 2.0 Tag: 122752
Creating Schema
In ADO.Net, can I create "create table ( ... )", "alter table ..." stuff,
and execute it to create my schema for MS-SQL2000?
Jack Tag: data access block for ADo.NET 2.0 Tag: 122751
How to use backgroupworker to load dataset?
As the existing application is running very slow when start application, How
to use backgroupworker to load dataset? Tag: data access block for ADo.NET 2.0 Tag: 122750
SqlExpress & C# problem in an ASP.NET web site
I'm trying to create a SqlServer express database file on the fly in a web
application..
(mhh.... maybe I should try to get something running in a desktop
application first?)
Anyway I want to connect to a database file and, if it doesn't exist, create
the DB on the fly.
Actuall I'm trying to create the connection like that:
I'm trying to create a connection like that:
===
public static SqlConnection GetConnection(string filename)
{
string connString = @"Data
Source=.\SQLEXPRESS;AttachDbFileName=|DataDirectory|{0}.mdf;Integrated
Security=True;User Instance=True";
connString = string.Format(connString, filename);
SqlConnection sqlc = new SqlConnection(filename); // <= exception here
return sqlc;
}
===
It fails with "Format of the initialization string does not conform to
specification starting at index 0."
mmh..
is it because the file doesn't exists?
How am I to connect to SqlServer to run the SqlSever creation script if my
file doesn't exist?
Should I embed an empty database as a resource in my control library if I
want to automatically create the database?
Or is there an other way? (I have the creation Sql script ready, I just
wonder how to run it).... Tag: data access block for ADo.NET 2.0 Tag: 122741
Conectar BD
Hola a todos y Feliz año 2006:
Tengo que crear una aplicación que accede a una Base de datos, y los datos
cambian constantemente en las tablas de la Base de datos, esos cambio son
nuevos registros.
Hasta el dia de hoy estado utilizando el componente DOA para Oracle, y estoy
permanentemente conectado a Oracle y cada vez que hay un nuevo registro
automaticamente se actualizan todas las pantallas de los clientes.
Cada cliente que utiliza la aplicación abre una conexión a Oracle y ésta es
permanente, se cierra solo cuando sale de la aplicación.
Ahora bien, en VS2005 como puedo hacer esto?? ya que aqui tengo en tendido
que se trabaja en MODO DESCONECTADO.
Ustedes, que me recomendarían?? como debo implementarlo con VS2005??
Agradecería mucho su valiosa ayuda.
Un saludo a todos y que este 2006 sea de mucha alegria., amor pa todos.
EWAT Tag: data access block for ADo.NET 2.0 Tag: 122739
About datatables
Hi
How to pass the content of one data table to another data table.I simply
tried using assignment operator...Example: datatable1=datatable2...But,its
not working..
ravindra Tag: data access block for ADo.NET 2.0 Tag: 122730
TableAdapter Performance
Hi,
Have anyone ever benchmark the TableAdapter performance compared to
DataTable's Load method? I found out that the DataTable's Load method is
about 10x faster than TableAdapter's Fill method.
I used the same SELECT query and DataSet (predefined), for both test.
For the DataTable's Load method, we first need to create a DataReader.
Anyone know why? Or is there any other configuration needed to make
TableAdapter faster?
Thanks for reading. Tag: data access block for ADo.NET 2.0 Tag: 122728
How to bind an object to a table
Hi,
I am new to .net. I think .NET provides what I need, but I don't
know how to implement it.
What I need is simply associating an object with a database
table. I would like to load "objects" from table, and I would like to
modify or delete objects, without dealing with database in anywhere. In
other words; I do not want to write SQL query for any of those
operations. Let me give you an example (in C++/CLI):
ref class MessageBase abstract
{
String^ m_strFrom;
String^ m_strBody;
String^ m_strSubject;
DateTime m_dtRecSent;
DateTime m_dtReplied;
DateTime m_dtForwarded;
MessageTypes m_mtType;
public:
property String^ From { String^ get(); void set(String^); }
property String^ Body { String^ get(); void set(String^); }
property String^ Subject { String^ get(); void set(String^); }
property DateTime ReceivedDate { DateTime get(); void
set(DateTime); }
property DateTime RepliedDate { DateTime get(); void
set(DateTime); }
property DateTime Forwarded { DateTime get(); void set(DateTime);
}
property DateTime SentDate { DateTime get(); void set(DateTime); }
property MessageTypes MessageType { MessageType get(); void
set(MessageTypes); }
};
I have got a table to store this information. I would like to
load "messages" from table at startup, through a factory (another
recommendation?). I have prepared a typed dataset, too, but I couldn't
associate it with this class. What I have done previously in C++ was a
simple adapter. Adapter was acting like a "message object" to the
application itself, any changes in the object automatically goes
database, too. As far as I have heard, after associating this class
with a table, I will not write any SQL statement.
I would be very happy, if you could enlighten me about this type
of association. I am using .NET Framework 2.0 (of course, since I am
using C++/CLI) and I do not have a performance concern with this
operation (I have heard that this type of association of an object with
a dataset is far slower than SqlDataReader way). Database is SQLite, I
am using ADO.NET class library to access database from .NET (I have
native library as well).
Thanks!
Jason Tag: data access block for ADo.NET 2.0 Tag: 122721
How to connect a DataView to an access database?
Im trying to understand DataView, to make a couple of lists of sorted data.
The 3 textbooks I have on .net dont have dataview in the index even.
Ive started by doing a database wizard. it finds the .mdb file and formats
the schema and genetated a program, I put a simple grid view in the form1
and pointed its source at the dataset.
But now I have to use DataView. Ive tried making a DataTable, and assigning
it to the dataset which only has the one table. I hook the dataview to a
second gridView. It doesnt complain, runs fine, but there is no data in the
gridView. I wired the gridView to the DataTable? still no data there.
Im searching the docs on how to use the DataView, have an example, but the
example builds up the table from scratch; I want to fill it with 2 specific
columns from the one table in the .mdb database.
Nothing Ive done gets the data into the 2nd gridView. I can manually add
columns to it, but I want the data from 2 specific columns. Seems easy.
Any suggestions appreciated. Tag: data access block for ADo.NET 2.0 Tag: 122720
newbie in search of ADO.NET code samples
Can anyone point me to step by step walk-throughs of ADO.NET code - I'd
like to get to the point of being able to programmatically work with
assigning field data to text boxes and then write back changes to the
tables.
As an aside; I started playing with Visual Studio 2003, and now VB 2005
Express. I come out of Dbase/Clipper/Foxpro/Delphi/MSAccess/ PHP-MYSQL- and
I must admit
to being driven out of my mind with datasets and dataadaptors and
datareaders - My eyes water -I just want the *data* - the levels of
abstraction from the data itself have been driving me from the .net
environment- and I'm sure I'm missing out on some good stuff - so far VB'05
has been no different in this way from VS '03 ; I need some
simple -step -by -step working code to build on - the MS Books so far have
lacked this, and the free training videos from MS only take me through a GUI
approach , whereas I want *CODE* - any pointers to this greatly
appreciated.
(While I'm at this - I appreciate the cleverness in MS's disconnected
approach to data - I do wonder however why a connected model (and thus a
simpler one) could not have been offered as well - at least in the more
amateur oriented (if I understand this correctly) VB 2005 Express ) Tag: data access block for ADo.NET 2.0 Tag: 122719
.NET 1.1 "System.Data.VersionNotFoundException" - I need a workaro
I have three related tables, and I am getting an exception when :
****************
Dim dataRows As DataRow() = ds.Tables(MappingName).Select_("",
"",DataViewRowState.Added)
dataAdapter.Update(dataRows)
******************
The exception is:
{System.Data.VersionNotFoundException}
[System.Data.VersionNotFoundException]:
{System.Data.VersionNotFoundException}
HelpLink: Nothing
InnerException: Nothing
Message: "There is no Original data to access."
Source: "System.Data"
StackTrace: " at System.Data.Common.DbDataAdapter.Update(DataRow[]
dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows)
at QuiltTrackDB.BaseSql.PersistChanges(DataSet ds, DataRowState rowState,
SqlConnection conn, SqlTransaction tran) in
C:\Projects\QuiltTrack\QuiltTrackDB\BaseSql.vb:line 594
at QuiltTrackDB.BaseSql.PersistAllChanges(DataSet ds) in
C:\Projects\QuiltTrack\QuiltTrackDB\BaseSql.vb:line 186"
TargetSite: {System.Reflection.RuntimeMethodInfo}
I think the problem might be that the table that I am trying to insert a
record into is the subject of a relational expression column for another
table that I am also inserting to in the same transaction, so removing the
expressions before persisting is my next attempt at a workaround. but any
advice would be appreciated. (This bug was found in 1.1, but it is still
there in 2.0)
I have to say I am sorely disappointed in MS and what they have NOT managed
to do over 5 or so years of ADO.NET - which is, to get the features they have
long documented - expressions and filters, working correctly.
David Rogers
Fred Hutchinson Cancer Research Center Tag: data access block for ADo.NET 2.0 Tag: 122716
OracleClient in VS2005 ???
Hi,
I am using VisualStudio 2005 (C#) and have to write a code to access
Oracle Database. I know that in .NET Framework 1.1, I could download
OracleClient namespace (System.Data.OracleClient.dll) and add
referenct to it in my project.
Can I do the same in VisualStudio 2005? When I look for OracleClient
in msdn, it says it is only for .NET Framework 1.1.
What can I use in .NET Framework 2.0?
Any help will be appreciated,
_dino_ Tag: data access block for ADo.NET 2.0 Tag: 122714
SQL Querry
Hello,
I trying to produce a querry that will accomplish the following and am not
sure how to write the statement.
I am currently using Jet 4.0 but will be using SQL Server soon.
Example Records
ID CustID Data Date Balance
1 1234 bla8 092705 42.00
2 2341 bla7 091405 14.00
3 3412 bla6 090205 32.00
4 4123 bla5 081805 65.00
5 3412 bla4 093005 34.00
6 2341 bla3 082705 19.00
What I want to accomplish is:
Return Data, Date and Balance Where Max(ID) For CustID 3412
SELECT Data, Date, Balance Where Max(ID) AND CustID = '3412'
The Querry should Return
bla4, 093005, 34.00
Any Assistance is greatly appreciated.
Chuck Tag: data access block for ADo.NET 2.0 Tag: 122700
Unexpected Timeout
I have an application that connects to sql server. Two installs of the
application are frequently experiencing the following error:
"System.InvalidOperationException: Timeout expired." We've checked and
confirmed that all connections are closed and disposed. The two sites that
are having problems with it also receive a lower than average amount of
traffic. I've had them check for deadlocked transactions and the maximum
number of concurrent connections. If anyone has any other ideas on what else
to check it would be appreciated. Thanks, Scott Tag: data access block for ADo.NET 2.0 Tag: 122699
Oracle Ref Cursor Issue in ADO.NET
Hello,
I ran into a performance issue with Oracle Ref Cursor in ADO.NET (with
VS 2003). The SQL itself runs in less than 5 seconds in SQL*Plus.
(Oracle 9i). When the same is called from ADO.NET using the microsoft
provider for oracle (system.data.oracleclient.dll version
1.1.4322.2032), the fill method takes upto 5 minutes to fill the
dataset. The result set returned is less than 100 rows and the row size
is less than 200 characters. Any ideas why this might be happening. Tag: data access block for ADo.NET 2.0 Tag: 122697
Whatever happened to ...
I seem to recall, back in the early promise days of Whidbey, that there was
talk (and even an early version) of a set of classes for mapping data
between objects and a database being a part of the release; alas I cannot
remember its name.
I know there are various ORM tools out there, and I may even look into some
of them but can anybody tell me
(a) what the Microsoft version was called when they were hyping it, and
(b) what happened to it.
Thanks. Tag: data access block for ADo.NET 2.0 Tag: 122691
Quirky response to Update command using datagrid
Using VS2003 and SQL2k.
I've noticed that if I have an expression column (or relation column) added
to the main table, I cannot do an Update without setting the
UpdatedRowSource to either OutputParameters or None. This works fine ... so
long as we do not execute two Updates in the same row, one after the other.
This causes a concurrency error.
I understand the general idea behind concurrency and the raft of issues that
can cause a "concurrency error" (did I mention that ADO.Net is SUPERB at
spitting out "concurrency errors" if you even look at the IDE wrong, but I
digress). In any event, my stored procedure doing the update returns a fresh
set of data after said update.
Okay, playing around with this a bit, I find that using the UpdatedRowSource
set to FirstReturnedRecord prevents concurrency errors when editing twice in
the same row, but of course, we would now have a concurrency error with the
expression column. So what gives? Is there a reasonable solution? Tag: data access block for ADo.NET 2.0 Tag: 122689
ado.net deleting record sql server
hello all,
Created procedure in sqlserver accepting id as parameter to delet
record.
initialized statements
Dim DeleteCommand As New SqlCommand("DeleteProc", conn)
DeleteCommand.CommandType = CommandType.StoredProcedure
dataAdapter.DeleteCommand = DeleteCommand
AddParams(dataAdapter.DeleteCommand, "testId")
At this following line i receive error
dataadapter.update(ds,"testmaster")
System.invalidoperationException
update requires a valid DeleteCommand when passed Datarow collectio
with deleted rows.
How to get along with this problem
Thanks in advance
karun
--
karuna
-----------------------------------------------------------------------
karunam's Profile: http://www.hightechtalks.com/m61
View this thread: http://www.hightechtalks.com/t231844 Tag: data access block for ADo.NET 2.0 Tag: 122677
Problem with adding new rows to dataset
Hi
I am busy with a C# Windows application. I load data from a MS Access
database into a DataSet. In my database the primary key is an AutoNumber
field.
When I load the data into the Dataset I add the following event handler to
the my OleDBDataAdapter:
[code]
adapter_MSAccess.RowUpdated += new
OleDbRowUpdatedEventHandler(DataAdapter_MSAccess_OnRowUpdate);
[/code]
The event handler code is as follows:
[code]
private static void DataAdapter_MSAccess_OnRowUpdate(object sender,
OleDbRowUpdatedEventArgs e)
{
if (e.StatementType == StatementType.Insert)
{
OleDbCommand oCmd = new OleDbCommand("SELECT @@IDENTITY FROM Absentees",
e.Command.Connection);
e.Row["AbsIndex"] = oCmd.ExecuteScalar();
e.Row.AcceptChanges();
}
}
[/code]
When I add a new rows to the datatable in the dataset for the first time
the primary key value in the new rows start at zero (0) regardless of whether
there are existing rows or not. After I update the database using
[code]
adapter_MSAccess.Update(ds, tableName_MSAccess);
[/code]
and I add further new rows, the primary key values in these new rows now are
correct according to the last primary key value in the database.
Is there a way to avoid the starting at zero of the initial primary key
values of new rows? The problem comes in when many new rows are added
initially because an error message comes up that says something like:
Column â??AbsIndexâ?? is constrained to be unique. Value â??3â?? is already present.
Any help will be appreciated. If there is a better way of going about it I
would be glad to learn about it. Tag: data access block for ADo.NET 2.0 Tag: 122676
TableAdapter Fill Code
Hello, I just purchased Visual Studios 2005. I noticed that when I drag a
control from the DataSources toolbar, or set the datasource property of a
datagridview, that code is automatically generated in the forms load event to
fill the dataset. How can I disable this feature? I normally fill my
datasets with buttons after a user enters search parameters, this feature has
become an anoyance. Can I maybe create a macro to turn erase the code?
Thanks in advance for all of your help.
--
Aaron Moore Tag: data access block for ADo.NET 2.0 Tag: 122672
dataset.merge not working correctly
Hi,
I am trying to merge two datasets into one, each dataset has one table when
I merge the two datasets I get a dataset with two tables? I need the merged
dataset to only contain one table with the merged data. Does anyone know how
to avoid this? Tag: data access block for ADo.NET 2.0 Tag: 122670
Combining fields from different tables into 1 dataset
So far the dataset just shows
Type, Benefit, Change
I want it to show
Type, Benefit, Change, Description
This should be a pretty elementary question - and I've spent 2 days on it
already.
I just want to add one field from another table into my dataset, should be
easy, but maybe it's the way it is related that is making it so difficult
(there are no totally unique fields in either table, so it needs a multi-join)
I have 2 tables in the dataset already:
Membership
BENFT
To get the Desc Field from the BENFT table, I need to relate 2 fields to
Membership
Membership.Benefit = BENFT.BNFT
Membership.Change = BENFT.BCHG
'This is what I tried so far, but it's not working
daBenefits.Fill(DsBenefits1, "Membership")
Dim relBenefit As New DataRelation("relBen",
DsBenefits1.Tables(0).Columns("Benefit"),
DsBenefits1.Tables(1).Columns("BNFT"))
Dim relBenChg As New DataRelation("relChg",
DsBenefits1.Tables(0).Columns("Change"),
DsBenefits1.Tables(1).Columns("BCHG"))
DsBenefits1.Relations.Add(relBenefit)
DsBenefits1.Relations.Add(relBenChg)
daBenefitDesc.Fill(DsBenefits1, "BENFT")
'DGMembers is the DataGrid
DGBenefits.DataSource =
DsBenefits1.Tables("Membership").DefaultView
DGBenefits.DataBind()
Thank you
Note: Membership is actually a union that I have filled for each piece into
the dsBenefits1 Tag: data access block for ADo.NET 2.0 Tag: 122662
.Net 2.0 DataTable have a lot of lacks?
it seem that data table and Expression field have a lot of Laks, it is
true?
the DataTable is powerfull of Memory relation data that bind to
controls.
so i can load data from remote service and manipulate it and after i
send update to remote service.
But, when i need to make standart operation that with SQL system is
simple,
with Datatable it's impossible.
for example think about Accounting records. i load record from remote.
and thaen
user chnge Movement and add some. now (before we update the remote
server),
how i can put on the screen balance? by loop over all rows and grouping
it manually!!
instead write Group by!!??
[in vb6 i remember the Data Environment that allow grouping!!]
have some Project that extend DataTable abilities?
also with DataColumn.Expression have a Lacke of many simple function.
like Round, have a way to extend it? Tag: data access block for ADo.NET 2.0 Tag: 122661
datarow duplication and unique key conflicts
Hi all,
I need a quick way to create a new datarow based on an existing one
change a few values and update them to the database (the duplication
should be made in the same db table).
I've seen previous posts suggesting to use the ImportRow method for the
datatable...
i've tried it..
i see rows growing in the "in-memory" datatable... but updating to
database won't work...
any suggestion?
the code i'm using is:
Dim sql As String
sql = "select * from mytable"
Dim dt As New DataTable
Dim da As New OleDbDataAdapter
Dim cm As New OleDbCommand(sql, Conn)
da.SelectCommand = cm
Dim custCB As OleDbCommandBuilder = New OleDbCommandBuilder(da)
da.Fill(dt)
dt.ImportRow(dt.Rows(0))
dt.Rows(3)("myid") = 12
da.Update(dt)
"myid" is a numeric primary key Tag: data access block for ADo.NET 2.0 Tag: 122656