[REPOST] SMO Table Owner
Using SMO, how do I get a table's ower? I'm scripting out some tables to disk
based on the table's name, but I'm getting a clash on the file name because
the same table name exists with different owners. I want to encorporate the
owner's name into the file name to prevent such clashes.
Thanks.
Scott C. Tag: Load XML file created from ADO 2.x Tag: 128382
DataReader .HasRows but returns 'Invalid attempt to read when no data is present' error
Hi,
I am using a stored procedure to extract data from an SQL server
database using a datareader.
The datareader .HasRows returns true, i have also checked this with
query analyser, but when i attempt to use a returned value to
SelectValue in a combobox I get the error 'Invalid attempt to read when
no data is present'. How can this be when .HasRows is true?
Here's the relevant code:
SqlCommand cmdLesion = new SqlCommand ("proc_SelectLesion", conn);
cmdLesion.CommandType = CommandType.StoredProcedure;
cmdLesion.Parameters.Add(new SqlParameter("@patientNo", strPatientNo));
cmdLesion.Parameters.Add(new SqlParameter("@lesLocation",
strLesionLocation));
conn.Open();
SqlDataReader dr;
dr = cmdLesion.ExecuteReader(CommandBehavior.SingleRow);
if(dr.HasRows)
{
lesionLocationCboBx.SelectedValue = dr["lesNo"].ToString();
}
else
{
lesionLocationCboBx.SelectedIndex = 0;
}
dr.Close();
And the stored procedure "proc_SelectLesion":
CREATE PROCEDURE proc_SelectLesion
(@patientNo int,
@lesLocation varchar(50)
)
AS
SELECT lesNo
FROM tbllesion
WHERE lesLocation = @lesLocation AND patientNo = @patientNo
GO
Any ideas?
Many thanks. Tag: Load XML file created from ADO 2.x Tag: 128381
DataSet ReadXmlSchema doesn't support <xs:any>
If someone could please confirm this is a problem or notify me of a
work-around I'd really appreciate the help. I've pulled some hair out on
this one.
I need to support an Element in the Xml schema that can support any XHTML
element as defined in the namespace "http://www.w3.org/1999/xhtml". I've
used the <xs:any> element as you see in the sample schema below.
When using ReadXmlSchema() to load this .XSD file I see the DataSet has two
tables. One for Person with firstName and lastName columns. The second
table is titled htmlstuff with a column to link to the parent Person record
("person_Id").
I need to either get the ReadXmlSchema() to add a column such that I can
push xhtml content into the Dataset or add it manually so it complies with
this schema.
Any suggestions?
Here's a schema:
<xs:element name="Person">
<xs:complexType>
<xs:sequence>
<xs:element name="firstName" type="xs:string" />
<xs:element name="lastName" type="xs:string" />
<xs:element name="htmlstuff">
<xs:complexType>
<xs:sequence>
<xs:any namespace="http://www.w3.org/1999/xhtml"
maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType> Tag: Load XML file created from ADO 2.x Tag: 128371
Shot in the Dark
Is it possible to populate a datatable with the contents of a string
variable? It's not in xml format, but instead it is the contents of a
csv. I realize I'm grasping, and I did several searches online and
found nothing, but I'm thinking there must be some way to combine things
like streamreaders with data adapters, or some such thing. Thanks for
anything you can suggest.
Tom Tag: Load XML file created from ADO 2.x Tag: 128368
Comparing DefaultValue to DataRow column values
The code below should it seems to me work but doesnt:
bool rowChanged = false;
foreach (DataColumn col in row.Columns)
if (col != row.Table.PrimaryKey[0])
if (col.DefaultValue != row[col])
rowChanged = true;
When debugging it I found that for a bool type column whose
DefaultValue is true and whose row[col] value is true, the code goes
into the last if statement and sets rowChanged to true. When I get
VS.Net Command window to print out the value of (col.DefaultValue !=
row[col]) it even says false. However somewhat suspiciously the full
dump of the variables col.DefaultValue and row[col] are different
although they imply their values are the same.
I seem to remember something about DataRow column values being held in
types which allow for a DBNull.Value value. So I may be trying to
compare two different types here I suspect.
However I can't find any way of cooercing an object into another type
where that type is held in a variable something like this:
System.Type tp;
object x = (tp)row[col];
I've had to write some hideous code which deals with all the different
possible types on a case by case basis.
Anyone got a better idea?
PS anyone who writes a reply asking why I want to do this without
suggesting any solution will get flamed Tag: Load XML file created from ADO 2.x Tag: 128363
How to read the first sheet in Excel
We can use the codes below to read the sheet name mySheet in a Exel file.
string strConn = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" +
Server.MapPath("Book1.xls") + ";Extended Properties=Excel 8.0";
OleDbConnection conn = new OleDbConnection(strConn);
OleDbDataAdapter adp = new OleDbDataAdapter("Select * from
[mySheet$]",conn);
DataSet ds = new DataSet();
....
But if we do'nt know the sheet name, but I just want read the first sheet in
the excel file.
How can I do? Tag: Load XML file created from ADO 2.x Tag: 128362
.Net Reporting against Oracle
Here's my issue. We've decided to replace a very critical (without it
the business would lose lots of money) departmental reporting system
with a built from scratch system based on .NET. The key component is a
datagrid (it really turned the CIO's head).
The issue is that the data source is Oracle. We've got a very complex
reporting system that produces dynamic sql and sends it to oracle and
takes back the result set and displays it. Each report has at least 3
filters and some more than a dozen. Each filter can either be a single
item, a list of 1 to N items or left blank. The idea is to push this
into Oracle stored procedures and get back a refcursor. The
filters/parameters effect not only the where clause, but can effect the
select clause, the from clause (what tables are queried) and when either
the from clause or select clause are effected the group by clause is
effected. This is a complex database (not large by data wharehouse
standards) with indexes and structure that are not friendly to
reporting. Speed of the reports is a critical issue. It's something
we've fought pretty sucessfully in the old system.
We've also got to have a batch component. That is a number of reports
need to run overnight and be available first thing in the morning. This
can't be just a single job that runs a bunch of reports. We need each
report to run separately. Oh and it needs to not start before certain
jobs are finished on the Oracle database.
Oh we've got a schedule of six months - nine months max and the clock is
ticking.
For the first issue. Has anyone done something similar. If so any key
problems with this (forget buy crystal, cognos etc. It's not cost they
are rounding error in our bottom line, but that decision is pretty set
also forget a data wharehouse - no time)
Second issue - does anyone know a good scheduler that will integrate
well with a .NET solution.
Thanks in advance. Tag: Load XML file created from ADO 2.x Tag: 128354
The Connection string to Excel
I use the ConnectionString below to read data from excel files.
It succss with some excel files, but fail with others.
I think the excel file have different versions.
How can I make a general connection string which can read Excel for
defferent versions?
------------------------------------------------------------------------------------
string sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data
Source=" + sExcelFile +
"; Extended Properties=" +
(char)34 + "Excel 8.0;IMEX=1;" + (char)34; Tag: Load XML file created from ADO 2.x Tag: 128353
Run SQL comand with String from SQL Script
Using SQL 2005 I generated a SQL Script to create a DB Table and columns. in
VB.NET i use the StreamReader to read this file to a string, and I want to
execute the script in my application, so the app can create an identical
table at runtime.
Obvously if i simply run the SQL Script from the file, it works, and if I
copy the StreamReader String while debugging into a SQL query, it also works
(creates the table) fine. However, when the program steps to the
SqlCmd.ExecuteNonQuery( ), I get a SQL Exception, "Syntax error near....".
The sql script (and command string) are very long, (Many tables, many
properties... many "Syntax error near"). I've tried to Replace single
(apostrophe) ' with '' and even single (quote) " with "", but the same
result. How come if I paste the string directly from the app to the query
analizer it works, but errors out in the app? Any suggestions?
Thanks
MATT Tag: Load XML file created from ADO 2.x Tag: 128350
SQL ProgramName
If i run a SP_who/SP_who2 on my SQL 2000 database to see whos running
what programs, i'm finding a lot of these are only showing ".Net
SqlClient Data Provider" as the program name rather than for example
"My SQL app 1"
We are using VB.net 2.0 with Visual studio 2005, is there a setting i
need to change somewhere for this or some code i can insert into my
app to change its name in the SQL database?
I have seen this done in older versions but i dont know how to do so.
Regards,
Andy Tag: Load XML file created from ADO 2.x Tag: 128345
populate many xml file into single dataset
I wanted to read two differrent xml files and put into the same dataset but
having different table names. I found most of example showing the 'fill'
method in dataadapter but no xml file. I will finally create the
relationship for joining two tables togeter. Can anyone here help me to
modify the code to allow to read the second xml file to the dataset?
Thanks,
Naruphon
using System;
using System.IO;
using System.Data;
class TestXML{
public static void Main(){
StreamReader rd = File.OpenText("Project.xml");
DataSet ds = new DataSet("Project");
ds.ReadXml(rd);
rd.Close();
// I need to load the job.xml here.
foreach(DataRow drProject in ds.Tables["Project"].Rows)
{
Console.WriteLine("{0}{1}",drProject["id"],drProject["Name"]);
}
}
} Tag: Load XML file created from ADO 2.x Tag: 128344
Error Message
Hi,
I am writing an ASP.NET 1.1 application that connects to a
Microsoft Access database using the OleDB data controls. I keep getting
this error
message:
"The Microsoft Jet database engine cannot open the file 'C:\MyDatabase.mdb'.
It is already opened exclusively by another user, or you need permission to
view its data."
The database is on my local machine and does not appear to be
open, so I cannot figure why I am getting this message. Also, the user
under which the web app is running has Administrator permissions.
Re-booting my machine has no effect.
Can anyone tell me the cause of this message and how to avoid it?
JD Tag: Load XML file created from ADO 2.x Tag: 128337
update without postback?
I'm just learning ADO.NET. Can you update a GridView without doing a
postback using DOM/javascript?
--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com Tag: Load XML file created from ADO 2.x Tag: 128332
Updating multiple records
Hello,
I want to know an efficient of updating multiple records in a .NET
datatable into a Oracle 9i databse without making multiple trips to the
database. That is, i want to know if Oarcle 9i can take the whole set of
records in the datatable in a stored procedure(in the form of XML or arrays)
and update records internally by looping through the records. I want to
acheive this using the OarcleClient that come with .NET 1.1.
I am currently experiencing huge delays(30 minutes) when i try to update
around 15000 records through the DataAdapters.Update method (I think the
delay is due to the fact the stored procedure is invoked for every record).
The database is in our intranet and is properly indexed on the update table.
Any thoughts on this?
I apperciate your help!
Thanks
Bala Tag: Load XML file created from ADO 2.x Tag: 128326
OracleConnection passing different application name
I'm writing a web service that is executing a stored procedure on an Oracle
data server. One of the things that this stored procedure does is to keep
track of 'who' is using it by storing some information from the V$SESSION
view. One of the columns being tracked is the client program name. But, what
I'm getting is the name of the web service, but what I really want is the
name of the program calling the web service.
Part of the framework that we have developped passes the calling program
name, so, I have that. What I don't know is how to pass that program name
instead of the web service program name. Does anyone have any ideas on how
to do this? For instance is there an undocumented keyword/value pair that can
be passed as part of the connection string. Or can I change the program name
attribute of the service?
Thanks
--
Jim Noeth Tag: Load XML file created from ADO 2.x Tag: 128323
Joins on many tables
Hello
I have one central table in my db, with a lot of related tables (many
to many relations).
I need to do some searches, on the central table and it related tables.
Previously it has been done by pulling everything up in a dataset and
adding a rowfilter.
This could be done because previously the app worked offline by pulling
everything into a dataset, and working on that dataset and in the end
submitting it to the database.
I have now been working on making the app being "more connected"
meaning that searches are being done directly on the db, and the data
being submitted instantly instead of waiting till the app shuts down.
Now as I mentioned i have to do the search in sql somehow.
But I have to do a lot of JOINs, and I am rather new in this area.
So could someone please point me in the right direction, do I need
stored procedures, views or something else?
Thank you in advance.
Klaus Hebsgaard Tag: Load XML file created from ADO 2.x Tag: 128322
system.Transactions
Hi everyone,
When I want to use the TransactionScope object, I need to include the
System.Transactions namespace.
But "using System.Transactions;" gives an error:
The type or namespace name 'Transactions' does not exist in the namespace
'System' (are you missing an assembly reference?)
When I get the folowing line in the web.config, it works:
<add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/>
Why does I need to add an assembly for the transactions and for other
assemblies not?
thanks for the explanation,
Filip De Backer Tag: Load XML file created from ADO 2.x Tag: 128308
stored procedure select statement with where clause
Hi,
Can anybody give me a sample code / sql script showing correc syntax
like SELECT * FROM TABLE WHERE FIELD =
the value to the where clause , i should be able to pass from the front end
it should return a result
how do i take this result? in a datareader? or in dataset?
thanks,
ss Tag: Load XML file created from ADO 2.x Tag: 128300
INSERT STORED PROCEDURE
Hi,
Can anybody give me a sample code / sql script to write a very good INSERT
INTO TABLE STORED PROCEDURE
1. It should take values from the client application which i should be able
to pass as parameters
2. it should take exception handling
bye
ss Tag: Load XML file created from ADO 2.x Tag: 128299
Is there a ADO.NET equivalent for ADOX
I want to get a list of all the tables in a database then for each table,
all the columns, their datatypes, then views, indexes, etc. etc.
The database may be of any technology - maybe only able to be connected by
an ODBC connection (not just a SQL Server database).
With VB6 and ADOX I can iterate through an ADOX.Catalog and do this.
Yes, I could use Interop (ADOX) but I'm trying to be "pure" using only
VS.NET 2005 so the question is "Is there an equivalent capability using
native VS 2005?"
Thanks for your help/advice Tag: Load XML file created from ADO 2.x Tag: 128296
TableAdapter update fail with inconsistent paramter
I use Wizard to build TableAdpater
My tableadapter is make by a select command:
Select ID, Name form Test
It update generate a update command:
Update Test set ID=@ID, Name=@Name where ID=@Orginial_ID
But when I use a gridview with the TableAdpater and set the DataMemberKeys
to ID, and Update data with this gridview, it fail with message:
can find update method with parameter Name,@Orginial_ID
I think the girdview did'nt pass the first ID parameter to TableAdpater.
How can I do? Tag: Load XML file created from ADO 2.x Tag: 128295
SqlParameter Class
When I use below code I get "Parameter count does not match Parameter Value
count".
Anyone know why I get this?
SqlParameter[] sqlParameters = new SqlParameter[2];
sqlParameters[0] = new SqlParameter("@NTUserName", SqlDbType.VarChar);
sqlParameters[0].Value = ntUserName;
sqlParameters[1] = new SqlParameter("@FlgActive", SqlDbType.Bit);
sqlParameters[1].Value = 0;
DataSet dsEmployee = null;
dsEmployee =
SqlHelper.ExecuteDataset(Configuration.GetAppConfigSetting("SQLConnect"),
"GetEmployee", sqlParameters); Tag: Load XML file created from ADO 2.x Tag: 128287
Change DataSource at RunTime
I Have some .mdb with the same table structure but different datas. So
i want to change at runtime the datasource without change de Form
design and the control binding... (if it's possible)
is that possible??
I thought to change only the connectionString and Refresh the DataSet,
but i don't think it's sufficient.
if that's correct, i really don't know how to change the
connectionString (autocreated at design time with a deafault
Datasource) and i don't know how to refresh all the datas
structures.... i'm sorry it's my first project.... and i'm alone
Anyone can help me! All suggestions and references are welcome. Tag: Load XML file created from ADO 2.x Tag: 128284
Row - BeginEdit and EndEdit -> Why?
Hi
Why would I use the BeginEdit and EndEdit on a row? The row still updates
without them.
Is it to just make it easier to roll back via CancelEdit?
Thanks
Vayse Tag: Load XML file created from ADO 2.x Tag: 128281
SqlBulkCopy and column mappings
Hey,
I'm replacing an old C++ DLL in our application that used BCP with an
SqlBulkCopy alternative.
The problem Iâ??m having is that the column mappings seem to compare the
destination column with that of the actual table and fails when there is a
difference in case. This comparison seems to be performed based on the
current thread culture rather than the database collation. The old BCP
implementation on the other hand was either case insensitive all the time or
obeyed the database collation.
Is there a way to either take into account database collation or temporarily
change the CompareInfo on the threads current culture to perform case
insensitive string comparisons?
Thanks.
Steve. Tag: Load XML file created from ADO 2.x Tag: 128278
Timeout in Transaction: Get two times the same data from table ada
In my function I have to retrieve some data two times. The first time it runs
without any problem but on second call I get an timeout error.
I´m very confused about this behavior because following code runs on two of
our machines and timeout error raises only on one machine.
At the following lines I´ve postet same sample code, which produces this
error:
TransactionOptions o = new TransactionOptions();
o.IsolationLevel = System.Transactions.IsolationLevel.Serializable;
for (int i = 0; i < 10000; i++)
{
listBox1.Items.Insert(0, i.ToString());
using (TransactionScope scope = new
TransactionScope(TransactionScopeOption.Required, o))
{
GetData();
listBox1.Items.Insert(0, "1111");
Application.DoEvents();
GetData();
listBox1.Items.Insert(0, "2222");
Application.DoEvents();
scope.Complete();
}
}
private void GetData()
{
TypedDataSet ds = new TypedDataSet();
TypedDataSetTableAdapters.tblActivityTableAdapter adapter = new
TypedDataSetTableAdapters.tblActivityTableAdapter();
adapter.Fill(ds.tblActivity);
listBox1.Items.Clear();
foreach (TypedDataSet.tblActivityRow row in ds.tblActivity)
{
listBox1.Items.Add(row.strName);
}
label1.Text = ds.tblActivity.Rows.Count.ToString();
}
for (int i = 0; i < 10000; i++)
{
listBox1.Items.Insert(0, i.ToString());
using (TransactionScope scope = new
TransactionScope(TransactionScopeOption.Required, o))
{
GetData();
listBox1.Items.Insert(0, "1111");
Application.DoEvents();
GetData();
listBox1.Items.Insert(0, "2222");
Application.DoEvents();
scope.Complete();
Thanks. Tag: Load XML file created from ADO 2.x Tag: 128276
software services
>From solution design and offshore software development to outsourcing
application support and improvement, Datagrep's offers a compelling
alternative to minimize software development costs, and improve the
quality of your software solutions and compress software development
time. We have been using state-of-the-art Quality Assurance
methodologies and practices in all its projects, focusing to deliver
error-free software services. We have delivered our services to
verticals including Healthcare, Financial Services and Banking,
Telecommunication, Retail, Security, Construction, Transportation etc.
Services: Our services include ERP, Web Development, Customized
Enterprise Solutions, Wireless/Mobile Application Development, Science
Intensive Development, Software Project Recovery, Database Development
and Migration, Linux/Unix Development, Embedded Software Development,
Porting and Migration, Legacy Systems, Re-engineering, Enterprise
Application Integration, Quality Engineering, Microsoft .NET
Development, Java Card Applications, Database solutions Java / J2EE
Development, Smart Card Solutions, etc. Process: Datagrep monitors the
overall direction for the project, including determining which features
the solution will and will not include, and a general schedule for
delivery. Then our team prepares the functional specifications, works
the design process through, and work plans, cost estimates and
schedules for the various deliverables. Testing highlights usage and
operation under realistic environmental conditions. The team aims on
resolving and triaging (prioritizing) bugs and preparing the solution
for release. Our testers develop the Test Plan, test cases and scripts,
the system and verify whether it functions as per the specification.
We support our customers with all required activities and procedures to
establish productive customer-contractor communication environment.
Project kick-off visits Normal visits to customer Onsite & offsite work
Regular project status reports, feedback Regular telephone conferences
(conference calls) For specific software development services
requirements write to info@datagrep.com Contact Name : Datagrep Email:
info@datagrep.com Web:www.datagrep.com Tag: Load XML file created from ADO 2.x Tag: 128270
DBMS for remote database management
I'm looking for something to change the MDB's layout on a website (of ours)
.
Would be nice to do that in the browser but some kind of ftp app would do
fine as well.
?? Tag: Load XML file created from ADO 2.x Tag: 128263
get DataColumn length
hi,
another ADO problem:
how can i get the Column legth as declaredat the Sql data base?
for example - char(6)filed, char(10), ..,
the DataColumn.DataType property bring me the Type System.String for those
columns but i need the specific length,
is it possible?
thank's
stan Tag: Load XML file created from ADO 2.x Tag: 128260
get table name problem
hi,
i am trying to get the original table name as declared at the sql database
but instead of the real name the DataTable.TableName always holds the word
"Table".
i am using VS 2 and Sql 2003
any ideas?
thank's
stan Tag: Load XML file created from ADO 2.x Tag: 128259
[Help] How to modify DataSource of CrystalReport at runtime?
Hello everyone,
I am using .NET 2.0 (WinForms - C#) for building my project. I faced a
problem while I tried to change datasource of CrystalReport.
These are my program snippets
CrystalReport1 obj = new CrystalReport1();
obj.SetDatabaseLogon("cipto", "cipto");
obj.SetDataSource(objEngine.manipulateData("SQL" ); //--> SQL =
select statemtens
obj.SetDataSource(dataSet1.Tables["result"]);
//objEngine= my engine to results
//dataset. i'm sure it works.
crystalReportViewer1.ReportSource = obj ;
In my crystal report i select all data , then in SQL statement
(at runtime) I changed the select
statement with some criteria, it wont run, in my case the result
displayed 'freak' data. :(
What's wrong with the code?
Thank you,
My Regards, Jati Indrayanto Tag: Load XML file created from ADO 2.x Tag: 128258
Updating datasource reports an error
Hi!
Could someone help?
I'm having trouble with the following code. Everythig goes fine till the
last line where I'm trying to update the datasource. The program stops
executing and displays the message "No value given for one or more required
parameters." I tried many ways of doing the same, nothing works.
Public Class FormX
Private Sub FormX_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim MyCNN As New Data.OleDb.OleDbConnection
MyCNN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=|DataDirectory|\MyDB.mdb"
Dim SelectStatement As String = "SELECT Field1, Field2, Field3 FROM
MyTable"
Dim MyDA As New Data.OleDb.OleDbDataAdapter(SelectStatement, MyCNN)
Dim strInsertCmd As String = "INSERT INTO MyTable (Field1, Field2,
Field3) VALUES (?, ?, ?)"
Dim InsertCmd As New Data.OleDb.OleDbCommand(strInsertCmd, MyCNN)
MyDA.InsertCommand = InsertCmd
Dim MyDS As New DataSet
MyDA.Fill(MyDS, "TableName")
Dim drNew As DataRow
drNew = MyDS.Tables("TableName").NewRow
drNew.Item("Field1") = "New value" 'string field
drNew.Item("Field2") = 12 'integer
drNew.Item("Field3") = 123 'integer
MyDS.Tables("TableName").Rows.Add(drNew)
MyDA.Update(MyDS, "TableName") <------------ the offending code
End Sub
End Class
I'd really like to understand what's going on.
Thanks,
Georges Tag: Load XML file created from ADO 2.x Tag: 128256
How to call an oracle function in C# 2.0?
Hello,
Assum i have an oracle function called ofunction.
Can someone tell me how i can call this function assuming it take the
parameter in_param of type clob.
Any help will be highly appreciated
C# .ADO.NET 2.0 Tag: Load XML file created from ADO 2.x Tag: 128251
Check to see DataColumn DataType is Boolean?
Hello,
Iam trying to do the following-
if(myColumn.DataType==typeof(bool))
{
}
I get the error "Operator == cannot be applied to operands type and object
and bool."
Is there a workaround?
Thanks.
jay Tag: Load XML file created from ADO 2.x Tag: 128245
ado.net and sql 2005
We have been testing a migration of our application from 2000 to 2005. All
seemed well until last week.
Our framework generates a set of business objects and maps them through a
DAL to a specific table/column. In Sql Server (we also support Oracle) our
columns definined by the developer as currency (internal type name) map to a
.Net 1.1 decimal type and a sql server table column of money. From my
understanding these columns have a default scale of 4.
In Sql 2000 (and oracle) when we perform a data adapter fill (sp_execute),
the decimal type is truncated down to 4 decimal places. Thus 34.3456432 gets
truncated down to 34.3456. This is fine with us because the excess precision
is a result of cost calculations and we have no interest in keeping the info.
The money type is stored correctly and our clients are happy.
YET... now in 2005 we get an exception passing the value. It complains
about exceeding the precision but I was under the assumption for a money type
that the precision was thirty something...
-------------------------------------------------------
Unable to apply changes to the DataSet (SqlException):The incoming tabular
data stream (TDS) remote procedure call (RPC) protocol stream is incorrect.
Parameter 5 ("@AREAAVGCST"): The supplied value is not a valid instance of
data type numeric. Check the source data for invalid values. An example of an
invalid value is data of numeric type with scale greater than precision
Here is the value: 5.9232811750188790881984289485
---------------------
What is going on? We have a client going live on 2005 and this makes no
sense. Are we supposed to check every decimal to see if it exceeds the
column precision?
Is there a database setting or something to turn on to fix this?
Thank you,
Russell Tag: Load XML file created from ADO 2.x Tag: 128244
problem writing blob to oracle
hi,
i have a problem writing a blob to oracle using ado.net. maybe someone can
help.
here's my code:
OleDbConnection con = new OleDbConnection("Provider=msdaora;Data
Source=orcl;User Id=******;Password=******;");
try
{
con.Open();
string save_blob = "INSERT INTO blobtable "
+ "(id,content) "
+ "VALUES "
+ "(1,:contentParam)";
OleDbParameter contentParameter = new OleDbParameter();
contentParameter.OleDbType = OleDbType.LongVarBinary;
contentParameter.ParameterName = "contentParam";
contentParameter.Value = this.content; // where content is an array of byte
OleDbCommand command = new OleDbCommand(save_blob, con);
command.Parameters.Add(contentParameter);
command.ExecuteNonQuery();
command.Dispose();
}
catch (Exception ex)
{
System.Diagnostics.Debug.Write("DATABASE ERROR:" + ex);
}
finally
{
con.Close();
}
now everytime i try and run that code i get the following error:
A first chance exception of type 'System.Data.OleDb.OleDbException' occurred
in System.Data.dll
DATABASE ERROR:System.Data.OleDb.OleDbException: ORA-01008: not all
variables bound
any ideas? Tag: Load XML file created from ADO 2.x Tag: 128243
Transactions with generated DataAdapters
Hello,
I have generated a DataSet with Visual Studio 2005 by selecting Data ->
Add New Data Source ... -> Database etc. from the menu and selected 2
objects (tables) in the Data Source Configuration Wizard. As a result I
get an .XSD DataSet file that automatically generated a DataAdapter.
I have added an insert statement to both tables.
Question 1: One table has an autonumber id field that automatically
generates a primary key when inserting a new row into the database. How
do I get that automatically primary key which I need for the insert
statement in the second table?
Question 2: Both insert statements should be performed in one
transaction. How do I set up a business method for inserting values
into both tables that executes both insert statements in one
transaction, i.e.
public void insertValues() {
MyFirstDataSet.MyFirstDataAdapter a1 = new
MyFirstDataSet.MyFirstDataAdapter ();
MySecondDataSet.MySecondDataAdapter a2 = new
MySecondDataSet.MySecondDataAdapter ();
// start transaction
a1.InsertValues("mike", "miller");
// a value is inserted into a table with autogenerated primary key
int key = ...
a2.InsertValues(key, "test");
// end transaction or rollback
}
Any help would be much appreciated.
Steffen Tag: Load XML file created from ADO 2.x Tag: 128237
Table name's in Dataset
Hello Guys,
I have a proc which returns variable number of tables. I want to do some
validations on these tables and dont want to use the index (e.g
Dataset.Tables(0)) to refer to the table, I want to use the tablenames
instead. I cant do a tablemapping either caus I dont know which table will be
returned at which position.
Is there a way to get the table names returned by the proc in the dataset
instead of the default names like Table1, Table2 ...
Thanks in advance... Tag: Load XML file created from ADO 2.x Tag: 128236
SMO Table Owner
Using SMO, how to I get a table's ower? I'm scripting out some tables to disk
based on the table's name, but I'm getting a clash on the file name because
the same table name exists with multiple owners. I want to encorporate the
owner's name into the file name to prevent such clashes.
Thanks.
Scott C. Tag: Load XML file created from ADO 2.x Tag: 128234
dataset merge bug!
my query returns 12000 rows
I m filling the dataset with increment size 5000
this.MainTableDA.Fill(ds,start,5000,MainViewName);
but when I merge two dataset with have 5000 rows it couse an error sometimes
it returns
shortly 5000 rows 5000 rows not equal to 10,000 rows. sometimes it have 7022
rows sometimes 65023 rows.
its not fixed.
the merge method is not working well
i think it is bacause merge method does not work well.
anyone have any idea?
Esref DURNA Tag: Load XML file created from ADO 2.x Tag: 128226
Help! Something adds 1 hour to my datetimes! :-S
Hi,
For some reason, somewhere in my application 1 hour is added to my dates,
depending in which time zone the application is run...
Because I don't have a clue where this happens, I posted this to the three
relevant newsgroups (vb/ado, sql and xml): my aplogize for this.
I'm doing a Synchronisation between two SQL Servers (2000): All the Data is
read into a DataSet, and exported to an XML-file:
SQL Server -> DataSet (VB.NET 2003) -> XML -> DataSet -> SQL Server
When I run everything in the West Central Africa Timezone (GMT+1, no
summer-time): everything works fine. But I notice that all my dates in my
XML-file are written like this
"<DATE_DEB_APP>2006-02-01T00:00:00.0000000+01:00</DATE_DEB_APP> ": with the
"+01:00" at the end. But not that big of a problem, because the application
writes the date with 00:00 hours to the database.
I (well, my pc) is in the Brussels Timezone (GMT+1: but because of the
summer-hour we actuallt have GTM+2 now).
Everything goes fine also when I put the databse on my local SQL Server,
make the XML-file, read it again, and write it to the other database (also
local). All the dates are also presented with the "+01:00"-suffix. Except
one: a date that the application writes to the database when filling the
DataSet, and select it at the end to put it in the XML-file also: this one
gets the suffix "+02:00":
<SyncSend>2006-05-03T09:58:19.6070000+02:00</SyncSend>
So far so good: some not-really wanted things, but everything goes fine.
Problems start when I'm doing a synchronisation between an SQL server in
Central African TimeZone, and a local one in Brussels Timezone.
What hapens is that all my dates are having 1 hour added to them! So instead
of the "2006-02-01T00:00:00" they have as value "2006-02-01T01:00:00"!!
I somehow can understand why this happens; because 00:00h in Central Africa
is 01:00h in Brussels on this moment. But I don't want it to happen! I want
the exact time to be transfered!
Does anybody has a clue where this exactly happens? And how to prevent this?
Is there a way to say that it has to use the actual value? and not one that
calculates the time?
On this moment it's really nice to be able to use tha capbilities of the
DataSet with the XML-files and SqlDataAdapter with commandbuilder to do my
insert and updates. I won't really like to loose this :-S
Thanks a lot in advance!
Any help our hints would be really appreciated!
Pieter Tag: Load XML file created from ADO 2.x Tag: 128225
update tabledefinition using dataadapter and datacolumn
Hi everybody!
I'm trying use the datacolumn class to create new columns in a datatable
object and submit the new created column to the database (Access 2000).
Here's the code:
Sub Main()
Dim oconn As New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;
Data Source=C:\test.mdb")
Dim adapter As New OleDbDataAdapter("SELECT * FROM Cities", oconn)
Dim mydt As New DataTable
Dim nCol As New DataColumn
adapter.Fill(mydt)
With nCol
.Caption = "Newcolumn"
.DataType = OleDbType.Boolean.GetType
End With
'Add column to Datatable
mydt.Columns.Add(nCol)
'Write changes to database
adapter.Update(mydt)
ReadLine()
End Sub
I know I could use "ALTER TABLE ALTER COLUMN" commands as well, but is there
any way to create/update columns to a table in a database using ADO.NET
(without using DAO or ADOX)
Thanks for your efforts!
wkr binder Tag: Load XML file created from ADO 2.x Tag: 128224
VS2005: Bug in Rowchanged event during cascade update?
New 'behaviour' in ADO.NET 2.0?
In a DataSet, I create a ParentTable with a Primary Key (ParentID).
I then create a ChildTable with a Primary Key (ChildID) an a ParentID
column.
I create a Relation from ChildTable.ParentID to ParentTable.ParentID
with both Relation and Foreign Key Constraint and Cascade Update rule.
I then write at little program:
1. Add a row to the ParentTable (ParentID = 1).
2. Add a row to the ChildTable, referencing the row in the ParentTable.
3. Add RowChanged handlers to both tables.
4. Update ParentID in the parentRow (parentRow.ParentID = 100);
- The ParentRow is updated and the update is cascade to the ChildTable.
ChildTable.RowChanged is fired.
The problem:
In the ChildTable.RowChanged handler I can see the childRow has been
updated:
((ChildTableRow)e.Row).ParentID is 100.
BUT
((ChildTableRow)e.Row).ParentTableRow returns null !!!
If I output ds.ParentTable.Rows[0].ParentID (I only have one row in the
table) it is 100.
The field has been updated in both tables - but
ChildTableRow.ParentTableRow cannot find it.
If I call ds.ParentTable.FindByParentID(100), null is returned.
When the ParentTable.RowChanged event is fired subsequently, there is
no problem with ChildTableRow.ParentTableRow.
What is going on? Can anybody help me?
Regards,
Zach Tag: Load XML file created from ADO 2.x Tag: 128223
Stored Procedure in SQL Server 2000 ?
Hi,
How do I get the all possible stored procedures for a given table in SQL
Server 2000 for example like
To Insert,
To Insert with Parameters,
To Update,
To Delete,
To Do Transaction ie for example to Transfer Some Amount from One Account to
Another Account. I should be able to pass the Account A, Account B and the
Amount to be Transfer.
Thanks & Regards,
SS Tag: Load XML file created from ADO 2.x Tag: 128220
binding navigator delete modification
The delete button in a data binding navigator by default will delete de
current row in the binding source. Can anyone tell me how can I cancel a
delete after a click on the button delete??
I want to do this in order to delete the current row just in some cases, for
instance when the user is asked to confirm the deletion.
Any help is very appreciated, Tag: Load XML file created from ADO 2.x Tag: 128218
Connection string is class module
Hello,
I put the connection string to the Web.config file, then in Global.asax I'm
assigning this string to the application variable:
cn = New OracleConnection
cn.ConnectionString =
AppCrypto.decrypt(ConfigurationSettings.AppSettings("ConnectionString"))
Then I use this to variable to connect to the server:
cn = New OracleConnection(Application("ConnectionString"))
Everything works great with the webforms. However, to keep my connection
code in one place, I put all my connection code in the class module. But in
the class module this doesn't work! I have to use exactly the same code as
in the Global.asax:
cn = New OracleConnection
cn.ConnectionString =
AppCrypto.decrypt(ConfigurationSettings.AppSettings("ConnectionString"))
This is not acceptable, because the connection is encripted, and if it gets
decripted every time my application connects to the database, it slows
things down badly.
Why the application variable doesn't work in the class module? Probably I'm
doing something incorrectly. The only solution I see now is to drop my
connection class and connect to db in the webforms, which is not a smart
application design.
Is there a better solution? I would appreciate your advice very much.
Thank you,
--
Peter Afonin Tag: Load XML file created from ADO 2.x Tag: 128217
DataTable.Select - There is no Row at position X -- Exception
Hello, I'm facing this problem for a long time from now...
I have a datatable that after a set number of rows gets all rows deleted
(and archived into a xml) but to not have a clash with id's I set the start
index from the datatable to the last id written in the xml plus 1, no
problem...
BUT... after a lot of deletes and inserts, when I run a .Select statement
into a DataTable I get this error "There is no row at position X" where X is
a number that really doesn't exist... but I simply run a select statement,
not a foreach nor nothing... it's nonsense to look for a data that doesn't
exist...
e.g.: if my table is limited to 200 entries, after a few selects, deletes
and inserts, it starts to return an error at some random position (not sure
if is random but absolutely is not the same row) for example, BUT, sometimes,
it says that there's no row in a position that has a row... I already
debugged and in a few situations, this exception was thrown on the row 10,
for example, but looking at position 10 of the datatable I could find data
AND ACCESS IT...
Does anyone knows something about it? Is some kind of bug...? Am I missing
something?!
Thanks in advance Tag: Load XML file created from ADO 2.x Tag: 128215
Creating Strongly Typed Data Set
Hi,
I created a strongly typed data set that contains two tables (Orders and
OrdersDetails). The tables have a parent/child relationship.
How can I populate both tables based on values returned by a stored
procedure in such a way so that the OrderDetails table contains only data for
orders that exist in Orders table (i.e. preserving the parent/child
relationship)?
I'm usng SQL 2000 and .NET 2.0
Thank you. Tag: Load XML file created from ADO 2.x Tag: 128214
Can anyone suggest an easier or better way to skin this cat? Two Select Queries
Hi All,
Here's my situation. I have two tables. Table1 is a 'transaction'
table. Table2 is a 'master' table. What I want to do is two-fold.
First I want to check if there is a match between ProdGrp (t1ProdGrp =
t2ProdGrp). If there isn't a match, indicate on the transaction there
is a critical error.
If there is a match, check to see if there is a complete match
(t1ProdGrp = t2ProdGrp AND t1Cat = t2Cat AND t1subCat = t2SubCat). If
there is a full match flag the transaction as valid. If not a full
match, indicate on the transaction there is a minor (correctable)
error.
My original thought was to create 2 select statements and do 2 queries
against Table2.
"Select * from Table2 where t1ProdGrp = t2ProdGroup "
"Select * from Table2 where t1ProdGrp = t2ProdGroup AND _
t1Cat = t2Cat AND t1subCat = t2SubCat"
That seems quite expensive in terms of processing. (Maybe it isn't)
The tables have the following key and field structure:
Table1
PK t1Date
pk t1Part
pk t1WH
t1ProdGrp
t1Cat
t1SubCat
....other fields.....
Table2
PK t2ProdGrp
pk t2Cat
pk t2SubCat
....other fields.....
Can anyone suggest an easier or better way to skin this cat?
Thanks,
Hexman
P.S. There are about 40 ProdGrps, each of the ProdGrps have 20 Cats
and each Cat has 3 - 20 SubCats. Tag: Load XML file created from ADO 2.x Tag: 128211
Can an XML file created from an ADO 2.8 recordset using