Hi all
I noticed that if Select stmt returns dataset containing two tables,
executing FillShema only populates schema info for first table only.
Simple test: (.NET 2.0)
....
string strSQL = "Select * from tableA select * from tableB"
OleDbConnection cn = new OleDbConnection (strConnection) ;
OleDbCommand cmd = new OleDbCommand(st rSQL);
cmd.Connection = cn;
OleDbDataAdapte r adapter = new OleDbDataAdapte r(cmd);
DataSet ds = new DataSet();
int ret = adapter.Fill(ds );
adapter.FillSch ema(ds, SchemaType.Mapp ed, "Table");
adapter.FillSch ema(ds, SchemaType.Mapp ed, "Table1");
Everything is working fine, except that for second table, shema info is not
set. In particular, MaxLength attribute of all string fields in second table
is always -1. In the first table, MaxLength shows real max length of a field.
Is there any way to fill schema for second table (and other tables if any)?
Thank you
Alex 8 5149
(just to revive this thread:)
Hey, C# experts, where are you?...
"Alex K." wrote:
Hi all
I noticed that if Select stmt returns dataset containing two tables,
executing FillShema only populates schema info for first table only.
Simple test: (.NET 2.0)
...
string strSQL = "Select * from tableA select * from tableB"
OleDbConnection cn = new OleDbConnection (strConnection) ;
OleDbCommand cmd = new OleDbCommand(st rSQL);
cmd.Connection = cn;
OleDbDataAdapte r adapter = new OleDbDataAdapte r(cmd);
DataSet ds = new DataSet();
int ret = adapter.Fill(ds );
adapter.FillSch ema(ds, SchemaType.Mapp ed, "Table");
adapter.FillSch ema(ds, SchemaType.Mapp ed, "Table1");
Everything is working fine, except that for second table, shema info is not
set. In particular, MaxLength attribute of all string fields in second table
is always -1. In the first table, MaxLength shows real max length of a field.
Is there any way to fill schema for second table (and other tables if any)?
Thank you
Alex
string strSQL = "Select * from tableA select * from tableB"
where's the semi-colon?
string strSQL = "SELECT * FROM tableA; SELECT * FROM tableB"
I would have thought you'd get a SQL Exception ....
"Alex K." <Al***@discussi ons.microsoft.c omwrote in message
news:C9******** *************** ***********@mic rosoft.com...
(just to revive this thread:)
Hey, C# experts, where are you?...
"Alex K." wrote:
>Hi all
I noticed that if Select stmt returns dataset containing two tables, executing FillShema only populates schema info for first table only.
Simple test: (.NET 2.0)
... string strSQL = "Select * from tableA select * from tableB" OleDbConnectio n cn = new OleDbConnection (strConnection) ; OleDbCommand cmd = new OleDbCommand(st rSQL); cmd.Connecti on = cn; OleDbDataAdapt er adapter = new OleDbDataAdapte r(cmd); DataSet ds = new DataSet(); int ret = adapter.Fill(ds ); adapter.FillSc hema(ds, SchemaType.Mapp ed, "Table"); adapter.FillSc hema(ds, SchemaType.Mapp ed, "Table1");
Everything is working fine, except that for second table, shema info is not set. In particular, MaxLength attribute of all string fields in second table is always -1. In the first table, MaxLength shows real max length of a field.
Is there any way to fill schema for second table (and other tables if any)?
Thank you Alex
On 2007-11-30 09:18:01 -0800, Alex K. <Al***@discussi ons.microsoft.c omsaid:
(just to revive this thread:)
Hey, C# experts, where are you?...
For what it's worth, I didn't see anything in your question that had
anything specific to do with C#.
It appears to be primarily a database question. Granted, there are
several C# experts following this newsgroup who _also_ are database
experts, and they do in fact sometimes answer database questions here.
But if you've got a database question and you really really need an
answer, you're probably better off posting the question to a database
newsgroup (even one that still is specific to .NET, if appropriate).
Pete
Peter,
the question is about how C# function FillSchema works, not about how
database works. On database side, I have no problems at all - of course, both
db tables have all their properties in place.
When you create a dataset using Select stmt, and then look into datatables
that are contained in that dataset, you will see that MaxLength property is
not populated unless you execute FillSchema on that dataset.
My question is: why FillSchema call only populates schema properties (e.g.
MaxLength) only for the first datatable in dataset?
Thank you for your response.
"Peter Duniho" wrote:
On 2007-11-30 09:18:01 -0800, Alex K. <Al***@discussi ons.microsoft.c omsaid:
(just to revive this thread:)
Hey, C# experts, where are you?...
For what it's worth, I didn't see anything in your question that had
anything specific to do with C#.
It appears to be primarily a database question. Granted, there are
several C# experts following this newsgroup who _also_ are database
experts, and they do in fact sometimes answer database questions here.
But if you've got a database question and you really really need an
answer, you're probably better off posting the question to a database
newsgroup (even one that still is specific to .NET, if appropriate).
Pete
Alex, here's your answer, direct from the docs:
Note
If the FillSchema method of the OleDbDataAdapte r object is called for a
command that returns multiple result sets, only the schema information from
the first result set is returned. When returning schema information for
multiple result sets using the OleDbDataAdapte r, it is recommended that you
specify a MissingSchemaAc tion of AddWithKey and obtain the schema
information when calling the Fill method.
Look for the topic:
"Adding Existing Constraints to a DataSet"
Liz
"Alex K." <Al***@discussi ons.microsoft.c omwrote in message
news:0B******** *************** ***********@mic rosoft.com...
Peter,
the question is about how C# function FillSchema works, not about how
database works. On database side, I have no problems at all - of course,
both
db tables have all their properties in place.
When you create a dataset using Select stmt, and then look into datatables
that are contained in that dataset, you will see that MaxLength property
is
not populated unless you execute FillSchema on that dataset.
My question is: why FillSchema call only populates schema properties (e.g.
MaxLength) only for the first datatable in dataset?
Thank you for your response.
"Peter Duniho" wrote:
>On 2007-11-30 09:18:01 -0800, Alex K. <Al***@discussi ons.microsoft.c om> said:
(just to revive this thread:)
Hey, C# experts, where are you?...
For what it's worth, I didn't see anything in your question that had anything specific to do with C#.
It appears to be primarily a database question. Granted, there are several C# experts following this newsgroup who _also_ are database experts, and they do in fact sometimes answer database questions here.
But if you've got a database question and you really really need an answer, you're probably better off posting the question to a database newsgroup (even one that still is specific to .NET, if appropriate).
Pete
Thank you, Liz
I have read this topic in the HELP. It didn't help much: I tried. When I do
this, it is trying to add UniqueConstrain t which causes another problems with
my query (real query, not the example I posted). Error handling routine grows
crazy.
I still hope to find simple and elegant solution to populate schema info in
multi-table dataset ... :-|
Thanks again.
Alex
"Liz" wrote:
>
Alex, here's your answer, direct from the docs:
Note
If the FillSchema method of the OleDbDataAdapte r object is called for a
command that returns multiple result sets, only the schema information from
the first result set is returned. When returning schema information for
multiple result sets using the OleDbDataAdapte r, it is recommended that you
specify a MissingSchemaAc tion of AddWithKey and obtain the schema
information when calling the Fill method.
Look for the topic:
"Adding Existing Constraints to a DataSet"
Liz
"Alex K." <Al***@discussi ons.microsoft.c omwrote in message
news:0B******** *************** ***********@mic rosoft.com...
Peter,
the question is about how C# function FillSchema works, not about how
database works. On database side, I have no problems at all - of course,
both
db tables have all their properties in place.
When you create a dataset using Select stmt, and then look into datatables
that are contained in that dataset, you will see that MaxLength property
is
not populated unless you execute FillSchema on that dataset.
My question is: why FillSchema call only populates schema properties (e.g.
MaxLength) only for the first datatable in dataset?
Thank you for your response.
"Peter Duniho" wrote:
On 2007-11-30 09:18:01 -0800, Alex K. <Al***@discussi ons.microsoft.c om>
said:
(just to revive this thread:)
Hey, C# experts, where are you?...
For what it's worth, I didn't see anything in your question that had
anything specific to do with C#.
It appears to be primarily a database question. Granted, there are
several C# experts following this newsgroup who _also_ are database
experts, and they do in fact sometimes answer database questions here.
But if you've got a database question and you really really need an
answer, you're probably better off posting the question to a database
newsgroup (even one that still is specific to .NET, if appropriate).
Pete
have you queried microsoft.publi c.dotnet.framew ork.adonet ? I don't know
anything about the NG but it has the right name .... :)
"Alex K." <Al***@discussi ons.microsoft.c omwrote in message
news:ED******** *************** ***********@mic rosoft.com...
Thank you, Liz
I have read this topic in the HELP. It didn't help much: I tried. When I
do
this, it is trying to add UniqueConstrain t which causes another problems
with
my query (real query, not the example I posted). Error handling routine
grows
crazy.
I still hope to find simple and elegant solution to populate schema info
in
multi-table dataset ... :-|
Thanks again.
Alex
"Liz" wrote:
>> Alex, here's your answer, direct from the docs:
Note If the FillSchema method of the OleDbDataAdapte r object is called for a command that returns multiple result sets, only the schema information from the first result set is returned. When returning schema information for multiple result sets using the OleDbDataAdapte r, it is recommended that you specify a MissingSchemaAc tion of AddWithKey and obtain the schema information when calling the Fill method.
Look for the topic:
"Adding Existing Constraints to a DataSet"
Liz "Alex K." <Al***@discussi ons.microsoft.c omwrote in message news:0B******* *************** ************@mi crosoft.com...
Peter,
the question is about how C# function FillSchema works, not about how
database works. On database side, I have no problems at all - of
course,
both
db tables have all their properties in place.
When you create a dataset using Select stmt, and then look into
datatables
that are contained in that dataset, you will see that MaxLength
property
is
not populated unless you execute FillSchema on that dataset.
My question is: why FillSchema call only populates schema properties
(e.g.
MaxLength) only for the first datatable in dataset?
Thank you for your response.
"Peter Duniho" wrote:
On 2007-11-30 09:18:01 -0800, Alex K. <Al***@discuss ions.microsoft. com> said:
(just to revive this thread:)
Hey, C# experts, where are you?...
For what it's worth, I didn't see anything in your question that had anything specific to do with C#.
It appears to be primarily a database question. Granted, there are several C# experts following this newsgroup who _also_ are database experts, and they do in fact sometimes answer database questions here.
But if you've got a database question and you really really need an answer, you're probably better off posting the question to a database newsgroup (even one that still is specific to .NET, if appropriate).
Pete
On Sat, 01 Dec 2007 06:43:00 -0800, Alex K.
<Al***@discussi ons.microsoft.c omwrote:
Thank you, Peter
When we talk about databases, we mean different things. What I call
database, is a SQL Server database, Oracle database, MS Jet database etc.
What you call database is just .NET database layer, database-oriented
part of .NET function set.
No, it's not "just" that. But yes, I do include the .NET database layer.
Yes, you are right when you are saying that FillSchema question is more
about .NET database layer. But as I told you, it has nothing to do with
databases themselves because not SQL Server, nor Oracle, nor Jet have
function called "FillSChema ".
So are you saying that any "C# expert" should be able to answer your
question? If not, I don't see why you are debating this at all. If so,
why does being an expert in C# imply knowledge of database-related topics?
[...]
When readers are posting questions about sockets, graphics or XML,
(examples from current page), they are not asking about C# using
your meaning of the word.
I readily acknowledge the large amount of traffic in this newsgroup that
is theoretically off-topic. My point is not to argue that you shouldn't
have asked your question here, and had you read what I'd written you'd
understand that.
My point _is_ that your impatience with the people in this newsgroup is
ill-placed. While you're free to ask the question here, you have no
reason to expect it would be answered. That's true for any question, of
course, but even more so for something as esoteric as the issue you're
running into.
[...] With your
permission or not, I will continue to post here all questions that I may
have about using C# in real world tasks
Again, you clearly have not bothered to read what I wrote. This isn't
about what you _may_ post here. It's about unreasonable expectations of
what sort of response you might get. Posting your original question
wasn't a problem at all. Acting like a "C# expert" ought to know the
answer to your question is a problem.
Furthermore, it's only a problem inasmuch as it sets you up for
disappointment. I'm not trying to take you task for doing something
wrong, as it seems like you think I am doing. Where does "with your
permission or not" come from? I'm not telling you what you may or may not
do. I'm just trying to be helpful.
If you don't appreciate the help, fine. But I don't see why you feel the
need to argue about what a "database question" is, and there's certainly
no need for the offense you appear to have taken regarding my motives.
Pete This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chris |
last post by:
Hi
I need to pass the entries in a text file to corresponding tables in a database. Can I pass the entire text file to a stored procedure or can I write a VB.NET procedure to pharse the file and pass the data to the database? This is a sample of the text fil
1120,011522169050,01,+0000001,031221,0005.95,2003,8331308,2003122...
|
by: Edward Mitchell |
last post by:
I have a database with text string fields defined by varchar(nnn). When I
request from the user the text from a textbox, I'd like to set the maximum
number of characters in the textbox to the "nnn" that was used in the
varchar(...) statement in the field definition. i.e.
Field1 varchar(25) NOT NULL
and in the .aspx file:
...
|
by: Programmer |
last post by:
Hi All
Here is my problem
I'm using a SQLDataAdapter and DataSet
I use the method FillSchema(myDataset, SchemaType.Source)
The problem is that when i Check the default Values of the Dataset
i can see that the DefaultValue of the columns is system.dbnull!!!!
But in SQL Server i have put as default values in a bigint field the '0' and
|
by: Andrea Temporin |
last post by:
We are working on a Db Oracle accessed by Oledb. We get connection using
MSDAORA.1 provider ad ORACLE 9.2 drivers on the PC.
We create datatables associated to the tables on the db, using FillSchema.
Some tables don't include primary key, even if they have the correct
structure on the db.
The datatables without primary key are few.
The...
|
by: Aaron |
last post by:
Hi,
The SqlDataAdapter.FillSchema method will automatically setup things
like the primary keys, auto increment, etc based on the settings on the
SQL Server. However, if you create a datatable using the SQL statement
that joins together data from multiple data tables, then FillSchema
does not work (as much? at all??). For example, if I use...
| |
by: Rich |
last post by:
Hello,
I want to use a dataAdapter to insert rows into a table on a sql server DB.
I understand that the DataAdapter will automatically handle concurrency
issues. So first I have to get a table to insert a row into. I have been
doing this:
da.SelectCommand = New SqlCommand("Select * from tbl1", conn)
da.FillSchema(ds,...
|
by: ReneMarxis |
last post by:
Hello all
first let me say i start getting an idea on how powerful data binding
is. You can hold your code as short as possible and also have a pretty
big flexibility.
Also thanks to this great community here, without you i bet many of us
would not succeed that fast.
So now to my problem :)
|
by: =?Utf-8?B?cm9kY2hhcg==?= |
last post by:
hey all,
i'm using the fillowing line:
DataTable dt=null;
da.FillSchema(dt,SchemaType.Source);
well, it's pulling in extra columns from another table. anybody have any
ideas?
thanks,
rodchar
|
by: =?Utf-8?B?cm9kY2hhcg==?= |
last post by:
hey all,
i'm using vs.net2005 to to retrieve records, via a stored procedure, from
sql server 2005 table. the primary key is set properly.
but when i use the fillschema(...) method the .Unique and .ReadOnly
properties are still set to false.
now i tried the same experiment with a northwind table and it worked fine.
both properties were...
|
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...
|
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...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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.
| |