How do I create a stand alone Dataset by ADO.NET?
Hi,All.
I have the code written below which runs on VB6 and ADO.
And I want migrate this onto VB.NET 2003 and ADO.NET.
Could anybody give me a sample?
Dim Rs As New ADODB.RecordSet
With Rs
.Fields.Append "ID", adLongVarChar, 10, adFldRowID
.Fields.Append "Name", adChar, 50, adFldUpdatable
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open
End With Tag: Calling DB2 Stored Procedure with Parameters Tag: 128109
Develop your own Accounting software using Microsoft technologies
Hi All,
New title for Mastering Web Application Development.
All secrets of developing an Accounting Software for the web revealed.
Title: "Develop your own Web Accounting Application using ASP.Net"
Price: $19.90
Pages: 300
ISBN:81-901331-3-6
Covers:
Master ASP.Net web development techniques.
Use these techniques to develop any Web Application of your choice.
Learn web programming and get a full web accounting software along the
way.
Learn how to use ASP.Net web server controls.
Learn how to install and configure the IIS (A must for using ASP.Net).
Learn how to access data in ASP.Net using ADO.Net.
Learn Inserting, Updating, Deleting and Retrieving data using
DataReader & DataCommands and DataSets.
Learn how to create DataTables and update records.
Program Datagrid for professional data entry forms.
1. Design and program an in-line ASP.Net datagrid feature into your
form.
2. Use a dropdown listbox in the footer of a datagrid to add a new
record.
3. Learn how to enable users add, edit, delete and cancel data in a
datagrid which is in a transaction like receipt, payment or sale.
4. Learn datagrid paging.
5. Learn how to use datagrid templates.
6. Learn adding a bound column to a datagrid.
7. Learn sorting columns in an ASP.Net datagrid control.
Secure your application (both windows and form-based authentication
discussed) in your intranet and internet. This feature alone covers the
cost of the books !!. All settings in IIS, Web.Config file and
programming Register & Login Pages explained.
Learn how to register users visiting your website and maintain their
database.
Cache data in ASP.Net datasets and display in ASP.Net pages.
Write stored procedures and call them from an ASP.Net page.
Use viewstate property in a database application.
Cache data & perform various filter operations in a dataview.
Deploy your web application successfully with no hassles.
Use Crystal Reports (both the PULL and PUSH methods) in an ASP.Net
application. Print reports just as in a desktop application.
and many more.
Regards
Math
http://www.vkinfotek.com Tag: Calling DB2 Stored Procedure with Parameters Tag: 128104
DataSet changes schema of XML file.
Iâ??d like to use the DataSet as the container for the XML files conforming to
some schema. The problem is, that the operation of reading the XML file into
the DataSet having its schema and then writing it back to the file makes it
invalid, not obeying rules of this schema.
Here is the simple test program performing this operation.
------------------------------------------------------------------------
using System;
using System.Data;
namespace DataSetTest
{
class Program
{
static void Main(string[] args)
{
DataSet DS = new DataSet();
DS.ReadXmlSchema ("XMLSchema1.xsd");
DS.ReadXml("XmlFile1.xml", XmlReadMode.IgnoreSchema);
DS.WriteXml("XmlFile2.xml", XmlWriteMode.IgnoreSchema);
}
}
}
------------------------------------------------------------------------
The schema is contained in the XMLSchema1.xsd file:
------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="XMLSchema1"
targetNamespace="http://tempuri.org/XMLSchema1.xsd"
elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema1.xsd"
xmlns:mstns="http://tempuri.org/XMLSchema1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="A" type="ct" />
<xs:element name="B" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="ct">
<xs:attribute name="attribute1" type="xs:string" />
</xs:complexType>
</xs:schema>
------------------------------------------------------------------------
Here is the valid XML file XMLFile1.xml:
------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<Root xmlns="http://tempuri.org/XMLSchema1.xsd">
<A attribute1 ="att"/>
<B>some text</B>
</Root>
------------------------------------------------------------------------
After transformation we get the XMLFile2.xml, which is invalid:
------------------------------------------------------------------------
<?xml version="1.0" standalone="yes"?>
<XMLSchema1 xmlns="http://tempuri.org/XMLSchema1.xsd">
<Root>
<B>some text</B>
<A attribute1="att" />
</Root>
</XMLSchema1>
------------------------------------------------------------------------
The XML is invalid because:
1. The enclosing XMLSchema1 element is added, which is not included in the
schema. This is not difficult to correct this by simple post processing, but
it would be more elegant, if there was a way of avoiding this.
2. The elements A and B have changed order although the schema organizes
them in the sequence structure. This happens, when sequence contains
intermixed simple and complex elements. WriteXml method always outputs simple
elements before complex, disregarding schema. I could not find any trivial
method of correcting this. It seems that the information about the order is
lost in the DataSet for such case.
Iâ??ll be obliged for suggestions. Tag: Calling DB2 Stored Procedure with Parameters Tag: 128103
Populating typed datasets WITHOUT tableadapters
Typed datasets are great, but in one respect, the move to use table adapters
is a double edge sword.
What I would like to be able to is to use the old fashion ds.tables()
components to be able to iterate through each of the tables in the typed
dataset and be able to fill them WITHOUT specifying each tableadapter .
Is there an easy way to do this that I am missing? if I use the Load Method,
I need to have a datareader and this means I need to get the selectcommand
for each table.
Are these accessible properties for each table?
I am sure I am missing something obvious
Thanks for your insight... Tag: Calling DB2 Stored Procedure with Parameters Tag: 128101
Adding collumn collation to a table in a data set
So, here's my new issue. When I add data from my external datafile to my
data table in my dataset I get an error on one of my columns because it
thinks i have duplicate values (happens to be my PK of my table) in this
specific column. Is it possible to add collation to a collumn in my data
table. I created the layout of the data table as follows:
dsInfo.Tables.Add(tblToLoad);
da.SelectCommand = cmdTableToLoad;
da.FillSchema(dsInfo, SchemaType.Source, strLoadTable);
the command is just a select * from the table I want to load that is in my
database. It grabs the schema and creates the correct collumns, but it
doesn't see the collation that collumn has in my actual database.
Any suggestions.
--
Matt
www.Fiddelke.org Tag: Calling DB2 Stored Procedure with Parameters Tag: 128098
Changing from DropDown to DropDownList
Why does my field not save when I change the control from DropDown to
DropDownList? I used the data from wizard. Thanks. Tag: Calling DB2 Stored Procedure with Parameters Tag: 128096
Strongly Typed ConnectionString keeps disappearing
VB 2003, Access 2000
I have been using strongly typed Datasets/database connections, it
works fine
Now, I've added a OpenFileDialog functionality to my program so the
user can select the database file.
I've added & strCon & to this code (it's a Global variable):
Me.conADOConnection.ConnectionString = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Data Source=" & strCon & ";Jet OLEDB:Engine
Type=5;" & _
"Provider=""Microsoft.Jet.OLEDB.4.0"";...........
It works fine for a while, but occasionally this whole command seems to
just disappear. It tends to happen if I add a control to my form or
make some other big change. If I paste the code back in from another
form it works fine (for a while).
Why does my connection string keep disappearing? Tag: Calling DB2 Stored Procedure with Parameters Tag: 128093
combobox binding problem
I have a combo box bound to a binding source wich is bound to a table. For
some reason the selectedvalue of the combo box doesn't show the correctt
value of the row the first time the form is showed. When I move to the next
row using a binding navigator the combobox selectedvalue have the correct
value and come back to the first record and it shows the correct value.
For instance if the field value is 2, the combobox selectedvalue is 0, it
looks that the binding is not working yet.
I tried using combobox.refresh() and changinng bindingsource.position on
the form_load and still doesn't work.
I also have other forms using combo box and they work without any problem.
I have setup displaymember and value member.
Any help is very appreciated. Tag: Calling DB2 Stored Procedure with Parameters Tag: 128090
heirarchical recordsets
I am converting my ASP sites to asp.net, one of the sites uses heirachical
recordsets and i was wondering what the equivelant is in ado.net
Also if there any sites with examples that i can study
regards Tag: Calling DB2 Stored Procedure with Parameters Tag: 128086
!!!HELP!!!! Errore while debugging a solution
Hi,
I've create a simple solution into my pc that read some data from an Access
DB and send them via WebServer to another DB.
When I try to include a WebService into my solution and run it in debug
mode, this dialog box appers
"No Source Code Available For Current Location"
Why?? if i try to include same Webservices into another application, I've no
problem.
I've just tried this link:
http://msdn2.microsoft.com/en-us/library/3sehk0fb.aspx
but it doen't work yet.
Could you help me please??
VS Version:2003
Framework v.1.1. Tag: Calling DB2 Stored Procedure with Parameters Tag: 128085
How to open files automatically after download?
I used the codes below to send a Excel file form Web Server to client.
The file is save to client's disk after download.
How can I open the file automatically after saving it?
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
MemoryStream sm= new MemoryStream();
....
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment;
filename=Test.xls");
Response.AddHeader("Content-Length", ms.Length.ToString());
Response.ContentType = "application/excel"; //octet-stream";
Response.BinaryWrite(ms.GetBuffer());
Response.End(); Tag: Calling DB2 Stored Procedure with Parameters Tag: 128082
Using Visual Studio & datagrid to select from sql server view
Hi,
I noticed another post similar to this, however I could not get my
issue solved.
I am using a datagrid, dataset and dataadapter to retrieve data from a
database view. I have done this successfully with tables and also
stored procedures. I could not use the table directly because I got an
error when I tried to create an SQLDataAdapter with visual studio
because the table had more than 100 columns in it. So I thought I would
create a view and use it.
System
1. SQL Server 2000 sp3 on Windows 2003
2. Visual Studio MDE2002 ver 7.0.9466
3. .Net Framework 1.0 ver 1.0.3705
Steps so far.
1.
2. Run in SQL Analyzer: select * from dbo.Web_WorkOrder where wonum =
'525794'
3. Capture using SQL profiler and Run in SQL Analyzer: exec
sp_executesql N'SELECT wonum, status, statusdate, worktype,
description, eqnum, location, faildate, changeby, changedate,
wopriority, ldkey, reportedby, reportdate, actstart, actfinish FROM
Web_WorkOrder WHERE (wonum = @WonumI)', N'@WonumI varchar(10)', @WonumI
= '525794'
Both of these work.
Regards,
Garry Tag: Calling DB2 Stored Procedure with Parameters Tag: 128078
=?iso-8859-1?q?vb_2005_rowfilter_mit_den_10_letzten_datens=E4tzen?=
hallo leute
ich hoffe ihr k=F6nnt mir weiterhelfen. ich m=F6chte (muss) einen
rowfilter bauen f=FCr die letzten 10 datens=E4tze meiner datenbank.
wie kann ich das hinbekommen?
gr=FC=DFe georg Tag: Calling DB2 Stored Procedure with Parameters Tag: 128072
framed
A client of mine has a young man who has written a web app (a CRM in dot.net
1.1) using many frames .it looks good , but is hard to maintain, passing, as
it does, parameters from one frame to the next. These parameters allow the
synchronization of datagirds, leading to my technically naive question (as I've
only played with VS 2003 ) : are frames at all necessary in a web app ? It
seems to me that eliminating them would allow for the use of simpler
variables to synch the datagrids ..he tells me the use of frames speeds up
data access... Tag: Calling DB2 Stored Procedure with Parameters Tag: 128069
ExecuteReader returns closed DataReader
Using .net 2 and Sql Server 2005, I am intermittently getting the exception:
Invalid attempt to FieldCount when reader is closed.
What I don't understand is how the DataReader could be closed when it was
just created by ExecuteReader.
As in:
dr = cmd.ExecuteReader() ;
Console.Write ( dr.FieldCount ) ;
If there's a problem (like the connection is closed) then why doesn't
ExecuteReader throw an exception? (For that matter, why doesn't
ExecuteScalar?) Tag: Calling DB2 Stored Procedure with Parameters Tag: 128047
foreach behavior changed in Framework 2.0
I have the following code in a C# project:
DataView dv = new DataView( dsModels.Tables[_INDVARS_TABLE_NAME], "", "",
DataViewRowState.CurrentRows);
foreach ( DataRowView drv in dv)
drv.Row.Delete();
This code worked fine in VS 2003 (Framework 1.1). However in VS 2005
(Framework 2.0) it behaves differently. It looks to me that the call to
drv.Row.Delete() actually deletes the next item in the list. I tested this by
creating two foreach loops, the first just outputs an ordinal value that gets
incremented each time through the loop and a unique id of the row; the second
loop outputs the same information and subsequently deletes the row with the
drv.Row.Delete() statement. I put a try/catch block around the output
statement in the second loop and in the catch block I output the ordinal
value and the error.
number of items in the dataview: 13
0: id = 861
1: id = 961
2: id = 966
3: id = 1089
4: id = 3194
5: id = 40
6: id = 3190
7: id = 3193
8: id = 3195
9: id = 422
10: id = 3192
11: id = 2477
12: id = 768
0: id = 861
1: id = 966
2: id = 3194
3: id = 3190
4: id = 3195
5: id = 3192
6: id = 768
7: error = There is no row at position 7.
8: error = There is no row at position 8.
9: error = There is no row at position 9.
10: error = There is no row at position 10.
11: error = There is no row at position 11.
12: error = There is no row at position 12.
It appears that the first call to drv.Row.Delete() actually deletes the row
with id 961 (the "next" row) rather than the row with id 861 (the "current"
row). To make things worse, it tries to keep iterating past the end which is
where the error messages are coming from.
I could not find any documentation regarding this behavior but I wasn't sure
exactly where to look. Any insight would be appreciated.
Thanks Tag: Calling DB2 Stored Procedure with Parameters Tag: 128043
problem with no rows being returned - but rows are there
Hi,
It seems that this issue is occurring at several client sites, though never
in house.
At some point, some (all?) queries run by our software start returning no
rows. But the rows are there in the database - and restarting IIS (this is a
web product) seems to resolve the issue. Even the following query:
SELECT SERVERPROPERTY('productversion')
Returns no rows under these conditions.
Like I said, restarting IIS, makes things go back to normal, and all the
queries being run by the .NET code are returning the expected results. There
is no apparent way to reproduce the problem or force it to happen.
There are no exceptions from the ADO.NET code - other then obviously our own
code, relying on certain pieces of data that isn't being retrieved for some
reason. No apparent problems opening connections or closing them, or running
the queries. Just
Anyone seen anything like this? Some sort of odd networking issue? Any
ideas? Tag: Calling DB2 Stored Procedure with Parameters Tag: 128041
Problems Using datasetObject.DefaultView for filtering and sorting.
I am using c# and VS2003 (.Net v1.1).
I am trying to filter and / or sort a dataset and print out the results as
shown below. I have seen several examples of using the DefaultView for the
table, but the results were sent to a UI control's datasource property.
Does anyone know how I can make use of the defaultView to retrieve either a
dataRow[] array, dataTable, or something else I could interate through and
print?
Alternatively, can anyone suggest alternat approaches to my problem?
public void process(DataTable myTable)
{
DataView myView = new DataView( myTable );
myTable.DefaultView.Sort = "TransactionCode";
myTable.DefaultView.ApplyDefaultSort = true;
foreach (DataRow currRow in myTable.Rows)
{
Console.Write ("TC " + currRow["TransactionCode"].ToString());
Console.Write (" / TY " + currRow["TransactionYear"].ToString());
Console.Write (" / IY " + currRow["InstallationYear"].ToString());
Console.Write (" / IY " + currRow["TransactionCode"].ToString());
Console.WriteLine (" / TA " + currRow["TransactionCode"].ToString());
}
}
/* Table structure in XML format
<DataRecords>
<DataRecordsId>5581</DataRecordsId>
<AccountNumber>99120</AccountNumber>
<GroupNumber>00</GroupNumber>
<CompanyNumber>03</CompanyNumber>
<TransactionCode>0</TransactionCode>
<TransactionYear>1969</TransactionYear>
<InstallationYear>1921</InstallationYear>
<TransactionAmount>-1047.6000</TransactionAmount>
<AdjustedTransYear> </AdjustedTransYear>
<ClassificationData> </ClassificationData>
</DataRecords>
*/ Tag: Calling DB2 Stored Procedure with Parameters Tag: 128040
Access 'Database In Use' Problems (also posted in microsoft.public.access)
Hi,
Apologies for posting the same message in 2 different newsgroups, but I
didn't know about this one until after I had already posted in the Access
NG. Any complaints to rubbishBin@junkyRubbish.com ;-)
Anyway...
I have a dotNet, C# application with about 10 users (Windows Forms, not ASP)
.
The basic setup is that each user has a copy of the program on their PC
which uses a local(ie on their PC) access database which contains the
queries and a set of linked tables that link to the actual datatables on a
single 'master' database which lives on the server.
So each user has a copy of the application and a copy of the 'queries'
database which all link to one 'data' database.
This is the connection string used to connect to the local 'queries'
database:
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data
Source=.\MyDb.mdb;Mode=Share Deny None;Extended Properties="""";Jet
OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database
Password="""";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet
OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet
OLEDB:New Database Password="""";Jet OLEDB:Create System Database=False;Jet
OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on
Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet
OLEDB:SFP=False";
It seems long, but I lifted it from somewhere else, and I'm not sure what
all the parameters actually do...
The problem is I am getting 'Database In Use' errors, not all the time, but
a few times a week. It even seems to happen if UserA is accessing one table
and UserB is accessing a totally unrelated one. Also, if I open a copy of
the 'queries' database on my PC and run a query then EVERYONE else gets a
Database In Use error if their copy of the application tries to access the
data. Please can anyone help me sort this out?
One other piece of information that may be relevant is the the problem is
worse since we upgraded our server operating system from NT4 to Microsoft
SBS2003.
Any suggestions or advise most gratefully received.
Thanks,
Chris. Tag: Calling DB2 Stored Procedure with Parameters Tag: 128033
Conenctivity to Interbase Database
Greetings to all.
How can we Perform database operations on INTERBASE using MS .NET 2005?
We want to Insert few records on an existing INTERBASE Database using MS.NET
,how itâ??s possible ?
Thanks for your support & time. Tag: Calling DB2 Stored Procedure with Parameters Tag: 128032
Transactions isn't rolled back, when using connecction pooling
I have a asp.net (1.1) Web Application.
Connection pooling is on
From that webapplication I execute this SQL with a commandtimeout of
10 seconds
"BEGIN TRAN
UPDATE XYZ set column1 = '3PU' where iid = 1234
WAITFOR DELAY '00:00:15
COMMIT TRAN"
The SQL will timeout during the WAITFOR DELAY - so COMMIT is never
called.
But the transaction is still open and locks are helt on ressources.
Even thou I call Close() and Dispose() on the connection - the
transaction isn't rolled back (because of the pooling the connection
is never really closed).
Only if I clear the pool - or when I reuse this connection again are
the transaction rolled back?
1) Is this a behavior I should be worried about in a production
environment? Do I risk that resources are blocked for longer periods
of time even thou the SQL has timed out (or failed) ?
2) Does it rollback the transaction again next time a random
connection is taken from the pool - or is it only when its this exact
connection that is being taken?
If connection pooling is off everything works as expected.
Any insight is appriciated..
Sample code:
SqlConnection connection = null;
SqlCommand command = null;
try
{
//create connection
connection = new
SqlConnection(Daisy.SqlDatabase.GetConnectionString(null));
connection.Open();
//create command
command = connection.CreateCommand();
command.CommandType =
CommandType.Text;
command.CommandTimeout = 10;
string sql = @"
BEGIN TRAN
UPDATE d_invoice_line set charge_code_id = '3PU' where invoice_id =
181685
WAITFOR DELAY '00:00:15
COMMIT TRAN'";
command.CommandText = sql ;
command.ExecuteNonQuery();
}
catch
{
}
finally
{
if (connection != null)
{
if (connection.State ==
ConnectionState.Open)
{
connection.Close();
}
connection.Dispose();
connection = null;
}
} Tag: Calling DB2 Stored Procedure with Parameters Tag: 128027
Saving Changes To DataSet in memory (without updating Database)
Hello I have a system where a customer can order a metallic alloy
product that is made from a variety of base metals. Every time the
customer adds an alloy to their shopping list the system works out how
much base metals are needed are deducts the relevant amount from the
stocks table.
I have this code which finds the stock level for a specific metal and
then reduces it by the necessary amount.
If baseNeeded >
CInt(dsTurbobraze.BaseMetalStocks.Rows(k).Item("BaseInStock")) Then
Exit Sub
dsDataset.BaseMetalStocks.FindByBaseMetalCode("Zinc").BaseInStock = _
(dsDataset..BaseMetalStocks.FindByBaseMetalCode(Zinc).BaseInStock) -
CType(baseNeeded, Integer)
First time I call this it works fine. But second time I call it, it
uses the original value (5000) rather than the new amount.
If I do a .Update command it works fine, but I don't want to save
changes to the Database until the order has actually been confirmed.
How can I save the changes to the Dataset in memory without saving to
the actual Database? Tag: Calling DB2 Stored Procedure with Parameters Tag: 128026
DataNavigator AddNew problem
I have a form in my c# application for adding the details for a car
(it's a car restoration database).
This form has a DataNavigator, and it also has a GroupBox which has
controls to allow the user to add images to the database. This groupbox
also has a datanavigator. It all seems to work fine, except for as
minor problem adding images. I use the following code to add a new
image to the bound PictureBox:
private void bindingNavigatorAddNewItem1_Click(object sender, EventArgs
e)
{
base.OnClick(e);
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
string filename = openFileDialog.FileName;
if (filename.Length != 0)
{
try
{
imagePictureBox.Image = new Bitmap(filename);
imagePictureBox.Show();
}
catch
{
MessageBox.Show(String.Format("{0} is not a
valid image file!", filename),
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
This seems to work ok, but the image isn't added to the database until
the addnew button is pressed again. I seem to be missing something.
Thanks for any help.
Mark Johnson
Derby, UK
} Tag: Calling DB2 Stored Procedure with Parameters Tag: 128025
Gridview returns old value of gridview.rows.count!
I have a label that shows the number of records returned by my
gridview. So after gridview ondatabound event I check to see if the
gridview.rows.count > 0, and if true then show row count in label but
empty gridviews my label shows an old row count of the previous
gridview. What can I do to get the current row count?
Thanx in advanx. Tag: Calling DB2 Stored Procedure with Parameters Tag: 128016
Create empty datatable from SQL Server table?
I'm using C# in Visual Studio 2003 and would like to create an empty
datatable in my dataset based on a SQL Server table. I basically want to use
the metadata of the SQL Server table without loading any data into my
datatable. What is the best approach to do this? Tag: Calling DB2 Stored Procedure with Parameters Tag: 128012
Getting Datarow from BindingSource
What's the best way to edit the Datarow which is referenced by
BindingSource.Current? Tag: Calling DB2 Stored Procedure with Parameters Tag: 128008
Addnew creating two records?
Hi,
I have a SQL Server 2000 database with an Identity Column called IssueNum
which auto-increments each time a new record is created.
I'm using the ADO.net 2.0 tools, a BindingSource and a BindingNavigator.
When I click on the AddNew button on the Binding Navigator, it adds two
records to the datatable, not just one. The AddNew button doesn't do
anything other than call the AddNew function of the Binding Source.
The new records don't get written back to SQL Server, but it's very annoying
to have one record, click the AddNew button, and then have three records.
I've seen a previous Newsgroup post where someone said that this was a known
issue with adding new records to a table with an Autoincrement field, but
there was no workaround mentioned.
Please help,
Andy Tag: Calling DB2 Stored Procedure with Parameters Tag: 128007
Compare Datarows
Hello. I have in dataset, two datatables. Each table has only two columns.
What I wish to do is to compare 1st table to see if the datarow can be found
in 2nd table. For example, lets say we are comparing student last name and
student ID, using both tables. Process is to retrieve the last name and ID
from 1st table, then iterate through 2nd table to see if data can be found in
the columns. I'm not sure if a comparison of both columns must be done or if
the comparison can be done at a higher level. Any info will be helpfull. I
use C# 05
toco Tag: Calling DB2 Stored Procedure with Parameters Tag: 127999
CommandBehavior.SingleRow
As far as performance is concerned, is it more efficient to set
SqlCommand.ExecuteReader(CommandBehavior.SingleRow) when you are only
dealing with single row?
Thanks Tag: Calling DB2 Stored Procedure with Parameters Tag: 127996
Excell
Hello,
I have opened an excel file into a .net application and any trying to
determine if column 1 is a checkbox or not. Spreadsheet column 1 has both
Text and Checkboxes. This is what I have tried to far with no success:
For Lines = 1 To xlSht.Cells.Rows.Count
xlRng = xlSht.Cells(Lines, 1)
If xlRng.Value.GetType is boolean Then
xlRng = xlSht.Cells(Lines, 2)
End If
Next
Actually I have tried lots of different ways to determine this and have run
out of ideas, Any assistance will be greatly appreciated.
Thanks,
Chuck Tag: Calling DB2 Stored Procedure with Parameters Tag: 127994
DbCommand against Oracle fails with string parameters
I have this code:
Dim cmd As DbCommand = Me.Factory.CreateCommand() '** this is a valid
OracleFactory object
Dim param As DbParameter = Nothing
Dim sql As String = ""
sql = "SELECT ard.*" & Environment.NewLine & _
"FROM MyTable ard" & Environment.NewLine & _
"WHERE ard.Client_Nbr = :ClientNbr" & Environment.NewLine
param = Me.Factory.CreateParameter()
param.DbType = DbType.String
param.Direction = ParameterDirection.Input
param.ParameterName = "Client_Nbr"
param.Value = "Yaba"
cmd.Parameters.Add(param)
cmd.Connection = Me.Connection '** this is a valid DbConnection to an
Oracle database
cmd.CommandText = sql
dr = cmd.ExecuteReader()
When I call the cmd.Execute reader, it fails with:
ORA-12571: TNS:packet writer failure
If I use a numeric parameter or remove the parameter and hard-code the
SQL statement's value for Client_Nbr, everything works fine.
Additionally, this works fine on my local box and fails on the server
(as far as I'm aware, they should be the same).
Any help is appreciated.
-Doug Tag: Calling DB2 Stored Procedure with Parameters Tag: 127993
ADO.NET and Excel
Hi!!, I need to populate an excel sheet with a query, some people says
that I can use CopyFromRecordset to do that but I need to add a
reference to an ADODB.Recordset, my question is, le ADODB library is
included in framework 2.0?, Do I have to make an extra instalation of
this library for the end users?
Thank you.
Ruben. Tag: Calling DB2 Stored Procedure with Parameters Tag: 127992
ContextSwitchDeadlock
Hello, I am getting this "ContextSwitchDeadlock" error message pop up in
situations where I am doing a Data Reader loop, where I am processing about
40,000 records. For each record read via the data reader, I am creating
another data reader to read another database table (can't join these tables -
on different machines) to get additional information. I am guessing that I
am getting this error message becuase the loop is taking longer the 60
seconds to complete. Here is what is said about the error
"The most probable cause is that a single-threaded apartment (STA) thread is
not pumping messages. The STA thread is either waiting without pumping
messages or is performing lengthy operations and is not allowing the message
queue to pump."
I'm sorry, but I do not have a clue as to what this means. The other
probable cause is a process is consuming too much memory. Not sure That this
would apply to me but perhaps opening and closing 40,000 data readers is
sucking up memory, although I would have expected the garbage collector to
have released this memory, but perhpas because it is all within the same
paragraph, the memory is not being release. I often just cancel out of the
error message and continue with the process and it completes successfully, so
I don't think it is a memory issue.
If I do not run in debug mode, I get the same error message running in
"Release" mode.
I read that you can turn off the MDA errors via the config file, but this
does not seem to me to be the appropriate solution to the problem... Does it?
Any ideas or suggestions?
Thanks in advance for your assistance!!!! Tag: Calling DB2 Stored Procedure with Parameters Tag: 127991
Converting between RowViews & Rows
Hi, I'd like to use a typed row to iterate through a DatarowView array. I've
used a view for its FindRows method.
How (or where) can I cast this so that the rows & rowViews will work
together. I've tried converting them in various places without success:
Thanks for any ideas. I can use an untyped in the loop but I'm sure this
must be able to be done.
Ant
// Tried converting here with no success
DataView dv = new DataView(dsMaster.Customers);
dv.Sort = "City";
DataRowView[] dr = dv.FindRows("London");
// Doesn't like this. Tried converting here as well
foreach (dsMaster.CustomersRow cr in dr)
{
MessageBox.Show(cr.City.ToString());
} Tag: Calling DB2 Stored Procedure with Parameters Tag: 127989
Dynamic dataset filter
Situation:
Vb .net windows application
SQL 2000 Database
I have a flat "customer" table on a database and wish to design an
application which behaves similar to itunes, so that the table can be
filtered.
For example instead of "genre" I want a list of "customer
class's" which will be generated from a "group by" on the
"customer class" on the "customer" table.
The difference is that in itunes you only click on one filter record,
which brings up the related records. This can easily be done using
relationships in the dataset.
I wish to add a check box next to each selection in the filter list and
build the related records up.
I tried look at including the checkbox field into the relations, but
this creates a number of problems.
I might be missing something here; I can see myself having to do all
the work on the server side. This would slow and costly.
The "customer class" is the first of 4 filters to be applied.
Any ideas..
Thanks Rich , Manchester , UK Tag: Calling DB2 Stored Procedure with Parameters Tag: 127982
Two DropDownList controls inside one DataGrid cell
Hi folks,
I have two code test samples that I am trying out. I want to have two
dropdownlist controls. The first ddl is databound with a list of company
names. The second ddl is databound with a list of contact names that reside
within the company that has been selected in the first ddl.
In the first sample, I have code where two dropdownlist controls are not in
a DataGrid. In the second sample, I have two dropdownlist controls that are
inside a cell of a DataGrid control.
The first sample runs fine. In the second sample, I am unclear what I need
to do.
Any reply would be much appreciated.
Here is my code for the first sample.
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
Dim dsCompanyNames as DataSet = New DataSet()
Dim dsContacts as DataSet = New DataSet ()
Dim coName As String
Dim proj = "Big Barn"
Sub Page_Load(sender As Object, e as EventArgs)
if not Page.IsPostBack then
ddlCompanyName.DataSource = GetCompaniesForThisProject
( )
ddlCompanyName.DataBind ( )
end if
End Sub
Function GetCompaniesForThisProject() As DataSet
dsCompanyNames.Clear()
Dim strConnString As String =
"Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data
Source=c:\sites\single29\gmeadows73\database\fdmdb.mdb"
Dim queryString As String = "SELECT DISTINCT
[users].[cname] FROM [users] WHERE ([users].[project] = '" & proj & "')"
Dim dataAdapter As New OleDbDataAdapter (querystring,
strConnString)
dataAdapter.Fill(dsCompanyNames, "users")
Return dsCompanyNames
End Function
Function GetContactNamesForThisCompanyAndProject() As DataSet
dsContacts.Clear()
Dim strConnString As String =
"Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data
Source=C:\sites\single29\gmeadows73\database\fdmdb.mdb"
Dim queryString = "SELECT [users].[name] FROM [users] WHERE
(([users].[cname] = '" & coName & "') AND ([users].[project] = '" & proj &
"'))"
Dim dataAdapter As New OleDbDataAdapter (querystring,
strConnString)
dataAdapter.Fill(dsContacts, "users")
Return dsContacts
End Function
Sub ddlCompanyName_SelectedIndexChanged(sender As Object, e As
EventArgs)
Dim list As DropDownList = CType(sender, DropDownList)
coName=list.SelectedItem.Text
ddlContactName.DataSource =
GetContactNamesForThisCompanyAndProject ( )
ddlContactName.DataBind ( )
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:DropDownList id="ddlCompanyName" runat="server" Width="204px"
AutoPostBack="True" DataValueField="cname"
OnSelectedIndexChanged="ddlCompanyName_SelectedIndexChanged"></asp:DropDownList>
<asp:DropDownList id="ddlContactName" style="Z-INDEX: 100; LEFT:
13px; POSITION: absolute; TOP: 71px" runat="server" Width="202px"
DataValueField="name"></asp:DropDownList>
</form>
</body>
</html>
Here is my code for the second sample.
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
Dim dsCompanyNames as DataSet = New DataSet()
Dim dsContacts as DataSet = New DataSet ()
Dim coName As String
Dim proj = "Big Barn"
Function GetCompaniesForThisProject() As DataSet
dsCompanyNames.Clear()
Dim strConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;
Ole DB Services=-4; Data
Source=c:\sites\single29\gmeadows73\database\fdmdb.mdb"
Dim queryString As String = "SELECT DISTINCT [users].[cname]
FROM [users] WHERE ([users].[project] = '" & proj & "')"
Dim dataAdapter As New OleDbDataAdapter (querystring,
strConnString)
dataAdapter.Fill(dsCompanyNames, "users")
Return dsCompanyNames
End Function
Function GetContactNamesForThisCompanyAndProject() As DataSet
dsContacts.Clear()
Dim strConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;
Ole DB Services=-4; Data
Source=C:\sites\single29\gmeadows73\database\fdmdb.mdb"
Dim queryString = "SELECT [users].[name] FROM [users] WHERE
(([users].[cname] = '" & coName & "') AND ([users].[project] = '" & proj &
"'))"
Dim dataAdapter As New OleDbDataAdapter (querystring,
strConnString)
dataAdapter.Fill(dsContacts, "users")
Return dsContacts
End Function
Sub ddlCompanyName_SelectedIndexChanged(sender As Object, e As
EventArgs)
Dim list As DropDownList = CType(sender, DropDownList)
coName=list.SelectedItem.Text
Dim ddlContactName as DropDownList
ddlContactName.DataSource =
GetContactNamesForThisCompanyAndProject ( )
ddlContactName.DataBind ( )
End Sub
</script>
<html>
<head>
<form runat="server">
<asp:DataGrid id="DataGrid1" runat="server">
<HeaderStyle backcolor="Navy" forecolor="White" font-size="9pt"
font-bold="True" horizontalalign="Center" />
<PagerStyle backcolor="Navy" forecolor="White" font-size="9pt"
font-bold="True" horizontalalign="Right" nextpagetext="Next >"
prevpagetext="< Prev" />
<Columns>
<asp:EditCommandColumn EditText="Edit" UpdateText="Update"
CancelText="Cancel" ButtonType="LinkButton" />
<asp:BoundColumn DataField="ID" HeaderText="Index<br>Number"
ReadOnly="True" />
<asp:TemplateColumn HeaderText="To">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "cname") %>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList id="ddlCompanyName" runat="server"
DataValueField="cname" AutoPostBack="True"
OnSelectedIndexChanged="ddlCompanyName_SelectedIndexChanged" />
<asp:DropDownList id="ddlContactName" runat="server"
DataValueField="name" />
</EditItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</form>
</head>
<body>
</body>
</html> Tag: Calling DB2 Stored Procedure with Parameters Tag: 127981
Architecture question
Hello,
I've come to a question, that seems to be more architecture-oriented, but it
also has some performance issues.
So,
I have the class that is sort of "master" of operation - the applications
would first instantiate this master class, and then all the work will be
done via this single instance. This architacture was chosen, because the
core objects of application are all saved in the database, and to avoid
repeat passing of database connection string when creating the instaces, I'd
rather like to abstract that away and have a master class that knows the
database connection from instantiation, and can create the child objects for
me, internally passing the reference to itself.
Example:
class Parent
{
private string dbConnStr;
public Parent(string dbConnStr)
{
this.dbConnStr = dbConnStr;
}
public string DbConnStr
{
get
{
return dbConnStr;
}
}
public Child Child()
{
return new Child(this);
}
}
class Child
{
Parent p;
public Child(Parent p)
{
this.p = p;
}
public DoStuff()
{
// Do something. If needs DB, use p.DbConnStr
}
}
Application:
Parent p = new Parent("...");
Child c = p.Child();
c.DoStuff();
The question now I am concerned about is, whether it's better to pass (and
hold in parent's private property) the connection string, or, rather, to
create a connection object in the constructor of Parent and forget the
connection string. It's sort of question - is it Ok to create the
connection, although we don't know if it will be needed. That should have
some performance implications?
Would be happy for some clues/suggestions
Rgds,
Pavils Tag: Calling DB2 Stored Procedure with Parameters Tag: 127980
Access File Lock
I am trying to run a simple VB.NET application using an Access 2000 database
as the OLEDB datasource directly from a CD. I have set the Locking mode =
read. When I autorun the application from the CD I get the error message
"Could not Lock File". When I run the same files from a folder on my USB Pen
Drive it works fine even when the Folder property is "Read-Only". I have
confirmed that no access.lockfile is created. Any ideas why it won't work
from a CD?
Thanks, Tag: Calling DB2 Stored Procedure with Parameters Tag: 127979
Displaying data from 2 tables in one datagridview
Hi all.
i am trying to display contents from 2 tables in one datagridview.
It is not possible for me to do a join, so i have to combine 2 datatables to be able to show data from both tables.
My tables are: "Customer" and "Customer Contact".
The relation is: Customer.c-Customerno = CustomerContract.cc-Customerno (the primary key names are not the same)
I want to display customers with the customers contact information.
Do i have to create a new datatable and populate this from det different tables in my dataset.
(ds.tables[0] and ds.tables[1]).
How can i do this. Please help. Tag: Calling DB2 Stored Procedure with Parameters Tag: 127975
Dataset converting date field accross time zones...
I need help wrt to the dataset converting the date (time) when passed from a
web server to a client, both on different time zones.
Lets assume that the Web Server is in NYC(EST). The client is in SFO(PST).
The client is making a web service call to the WS in NYC, which returns a
dataset containing a date field. The client is also interested only in the
date part of it. But, if the WS is returning the date as "04/25/2006
00:00:00 EST", when it gets to the client, the date in the dataset is
getting converted to "04/24/2006 21:00:00 PST". So, as the client is only
interested in the date part, he's getting it wrong (the client is getting
04/24 instead of 04/25).
This looks to me like a generic problem. Has anybody faced it before? What
would be the most efficient solution for this problem (other than passing
the date as a string in the dataset and converting it back to date in the
client side?)?
We are using .NET Framework 1.1 with Visual Studio 2003 on Windows 2000/XP.
Thanks for your help. Tag: Calling DB2 Stored Procedure with Parameters Tag: 127968
SQLSummit.com middleware lists: .NET data providers, ODBC drivers, OLE DB providers, XQuery engines, JDBC drivers
There's been an update to the middleware lists at SQLSummit.com,
including the list of .NET data providers. The JDBC and ODBC driver
lists have been partitioned for faster web page loading. The pages are
in alphabetical order by vendor, author or project name.
http://www.sqlsummit.com/DataProv.htm ADO.NET data providers
ODBC drivers, ODBC servers (start page):
http://www.sqlsummit.com/ODBCVend.htm
There have also been updates to the list of OLE DB Providers, XQuery
Processors and JDBC Drivers.
http://www.sqlsummit.com/oledbVen.htm OLE DB providers
http://www.sqlsummit.com/XQueryProv.htm XQuery engines
http://www.sqlsummit.com/JDBCVend.htm JDBC drivers and servers
======== Summit portals ===========
www.WebServicesSummit.com
www.SQLSummit.com
www.GridSummit.com Tag: Calling DB2 Stored Procedure with Parameters Tag: 127965
odbc & stream & excel file
I have to read a csv file. In order to avoid all the hassle with the
parsing (some items are in quotes, others are not, some have
quotes/comas in the items themselves, etc) I simply use odbc. The code
is shown bellow. The problem is that the source is actually a string (a
csv file downloaded from the internet via
WebResponse->GetResponse->GetResponseStream->ReadToEnd). So in order to
read it through odbc I have to store the string to a file just so that
I can pass the file to the ctor of OdbcConnection. Is there a way I can
avoid having to create a temporary file?
Thanks
connectionString = @"Driver={Microsoft Text Driver (*.txt;
*.csv)};DBQ=" + Path.GetDirectoryName(filename);
connection = new OdbcConnection(connectionString);
connection.Open();
command = new OdbcCommand("Select * FROM " +
Path.GetFileName(filename), connection);
reader = command.ExecuteReader(); Tag: Calling DB2 Stored Procedure with Parameters Tag: 127957
table versioning
Hi,
Since I don't know which group would be a right newsgroup to post for this
problem and most likely that it would be involved with expertise coming from
residents of different newsgroups, hope multiple-group posting is ok.
Solving this problem means a lot to me and my team. Thank you very much for
any suggestion or advice you may have.
I have a set of related tables A, B, C in my sqlserver db (my code is in C#)
and I want to keep multiple snapshots through out. A, B, C are large tables
and growing.
Scenario:
8:00:00am: A=a0, B=b0, C=c0; notation a0,b0,c0 are the data of version 0.
8:00:02am: A=a1, B=b1, C=c1; userFoo has made some change to the content
8:00:32am: my code detects that there is idle to the tables, that is there
is no change to it for 30 seconds, I want to take a snapshot of a1,b1,c1 and
store it in tables X,Y,Z for further processing that can take up 10-20
minutes. Copying or replicating the tables can take 5-10 minutes. After that
I plan to save the *result* of processing (denormalizing etc) X,Y,Z into
another set of tables and my other code would read off there to efficiently
serve data-mining for userBar.
8:00:40am: A=a2, B=b2, C=c2; userCar just made some more changes, notice
that this can happen while we are still taking the snapshot of a1,b1,c1.
That is the core of the problem.
8:01:10am: 30 second idle detected but I want to release only a version at
most for every 20 minute, I'll pass
8:01:20am: A=a3, B=b3, C=c3; userFoo just made another change
8:01:50am: pass another idle
8:21:20am: if a1,b1,c1 has been released, it's time to release new version,
repeat what needs to be done at 8:00:32am.
Would any experienced folk explain to me if possible to take the snapshot of
db like at 8:00:32am and the db still accepts changes userCar made at
8:00:40am?
I was thinking of using replication, as it seems to send commands over to
another database incrementally, I can detect idle at the subscriber and if I
can programmatically stop the subscriber for 10-20 minutes until I get a
good&full snapshot then I'll enable it back to so it can receive the
incremental update waiting in the queue. Is that even possible?
Programmatically and temporarily stopping a replication process is something
I never heard of.
Any other methods, suggestion, or advice? Thank you very much again for
looking into this. Tag: Calling DB2 Stored Procedure with Parameters Tag: 127955
Converting XMLDatadocument for dataset
Hi,
I have to pass XML data to a procedure.
I'm having xml data in XMLDataDocument datatype.
Now i want to use this XMLDataDocument as an input to the dataset inside the
procedure.
But dataset.ReadXML accpets only Textreader/Stream/XMLReader.
Can anyone pls tell me how to convert the XMLDataDocument into
Textreader/Stream/XMLReader??
my code looks similar to something like this:
Private Sub Procedure1(ByVal xmldoc As XmlDataDocument)
//here i will call ReadXML method
ds.ReadXML(xmldoc). Tag: Calling DB2 Stored Procedure with Parameters Tag: 127954
DataSet Xml Generation Does Not Honor Format of Supplied Schema
I'm having a problem in which the .Net 2.0 DataSet does not properly nest Xml
upon output when using a supplied schema.
I've created an Xml schema that I wish to push into a DataSet. My code then
pushes data into this DataSet (not from a Database). Finally, I want to use
the DataSet.GetXml() method to supply the data in the structure as defined by
my schema.
My understanding is that the Xml Schema standard allows us to define at the
root level a number of complexType entries which supply the structure of an
element. I can then instantiate this such as follows:
<xs:complexType name="examType">
<xs:all>
<xs:element name="task" type="taskType" />
</xs:all>
<xs:attribute name="examId" type="xs:positiveInteger" />
</xs:complexType>
<xs:element name="myRoot" />
<xs:sequence>
<xs:element name="exam" type="examType" />
</xs:sequence>
</xs:element>
<xs:key name="ExamIdKey" msdata:PrimaryKey="true">
<xs:selector xpath="exam" />
<xs:field xpath="attribute::examId" />
</xs:key>
<xs:keyref name="TaskExam" refer="rav:ExamIdKey" msdata:IsNested="true">
<xs:selector xpath="exam/task" />
<xs:field xpath="attribute::parentExamId" />
</xs:keyref>
In this situation I should have a nested structure of Xml elements. I've
also supplied the necessary <key> and <keyref> elements which the DataSet
should honor in defining the relationships between the tables. Unfortunately
I'm finding that the DataSet still creates a new column for the task element
called 'task_id'.
I've now chnaged my schema so I do not define the complexType structures
such as pictured above. I should be able to but I'm thinking this is a bug
in .Net 2.0. I've now changed it so the definitions exist in the
hierarchical fashion, I'm not referencing complexType definitions. You can
see the new schema below.
If anyone could PLEASE tell me if this is indeed a bug or what I'm doing
wrong. I should be able to define the primary keys and relationships in the
Xml Schema as I've done above. The DataSet.GetXml() should then use this
information to output the Xml in a hierarchical fashion as I need. But it
doesn't.
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://myschemaURI"
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:mysys="http://myschemaURI"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:simpleType name="taskClassSimpleType">
<xs:restriction base="xs:string">
<xs:enumeration value="type1" />
<xs:enumeration value="type2" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="statusSimpleType">
<xs:restriction base="xs:string">
<xs:enumeration value="scored" />
<xs:enumeration value="not-scored" />
<xs:enumeration value="unknown" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="filenameSimpleType">
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="taskPointsSimpleType">
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxExclusive value="100" />
</xs:restriction>
</xs:simpleType>
<xs:element name="statExam">
<xs:complexType>
<xs:all>
<xs:element name="exam">
<xs:complexType>
<xs:all>
<xs:element name="task" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="curriculumIndex" minOccurs="1">
<xs:complexType>
<xs:choice>
<xs:element name="locationIndex">
<xs:complexType>
<xs:attribute name="ver" type="xs:string"
use="required" />
<xs:attribute name="ch"
type="xs:positiveInteger" use="required" />
<xs:attribute name="o"
type="xs:positiveInteger" use="required" />
<xs:attribute name="pg"
type="xs:positiveInteger" use="required" />
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="sysTaskId" type="xs:positiveInteger"
use="required" />
<xs:attribute name="parentExamCountId"
type="xs:positiveInteger" use="required" />
<xs:attribute name="taskClass"
type="mysys:taskClassSimpleType" use="required" />
<xs:attribute name="status" type="mysys:statusSimpleType"
use="required" />
<xs:attribute name="graphicFilename"
type="mysys:filenameSimpleType" use="optional" />
<xs:attribute name="minPoints"
type="mysys:taskPointsSimpleType" use="required" />
<xs:attribute name="maxPoints"
type="mysys:taskPointsSimpleType" use="required" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="examCountId" type ="xs:positiveInteger"
use="required" />
<xs:attribute name="acronym" type="xs:string" use="required" />
<xs:attribute name="title" type="xs:string" use="required" />
<xs:attribute name="date" type="xs:date" use="required" />
</xs:complexType>
<xs:key name="TaskIdKey" msdata:PrimaryKey="true">
<xs:selector xpath="mysys:task" />
<xs:field xpath="attribute::mysys:sysTaskId" />
</xs:key>
<xs:keyref name="TaskExam" refer="mysys:ExamIdKey"
msdata:IsNested="true">
<xs:selector xpath="mysys:task" />
<xs:field xpath="attribute::mysys:parentExamCountId" />
</xs:keyref>
</xs:element>
</xs:all>
</xs:complexType>
<xs:key name="ExamIdKey" msdata:PrimaryKey="true">
<xs:selector xpath="mysys:examType" />
<xs:field xpath="attribute::mysys:examCountId" />
</xs:key>
</xs:element>
</xs:schema> Tag: Calling DB2 Stored Procedure with Parameters Tag: 127945
DataGrid Update Issue
Hi all,
I hope someone can help with this relatively simple problem.
I am building a timesheet application using ASP.NET C# with Visual
Studio 2003.As it is only a protoype application, my database has been
made in MSDE.
I have a DataGrid, which was working fine. The user could edit,update,
delete without a problem. However, I changed the DataGrid to make
certain columns 'uneditable' (such as the primary key, TimeSheetID)
.The problem now is that one of my Update Stored Procedure is not
working, as it references the Primary Key unique identifier column in
the DataGrid. To explain further, the code reads as follows:
private void Update_DataGrid(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
System.Web.UI.WebControls.TextBox tId = new
System.Web.UI.WebControls.TextBox();
System.Web.UI.WebControls.TextBox tHrs = new
System.Web.UI.WebControls.TextBox();
//This is the problem line!
tId = (System.Web.UI.WebControls.TextBox) e.Item.Cells[4].Controls[0];
tHrs = (System.Web.UI.WebControls.TextBox) e.Item.Cells[3].Controls[0];
SqlCommand myCommand = new
SqlCommand("NewUpdateTimeSheet",sqlConnection1);
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.Parameters.Add(new
SqlParameter("@TimeSheetID",SqlDbType.Int,4));
myCommand.Parameters["@TimeSheetID"].Value = tId.Text;
myCommand.Parameters.Add(new SqlParameter("@Hrs",SqlDbType.Float,8));
myCommand.Parameters["@Hrs"].Value = Convert.ToSingle (tHrs.Text);
This code worked fine before I made TimeSheetID 'read only'. The reason
I want it read only is because I do not want the user to be able to
update it. However it needs to be included as it is the unique
identifier that is used in the Stored Procedure 'WHERE' clause (WHERE
TimesheetID = @TimesheetID). The reason it is not working is that
whereas before the cell was editable, you could assign the value in the
editable cell to the 'tId.Text', now this is not possible. What code
would I use to tell the Update command to take the value from a normal
DataGrid cell - not in edit mode basically?..
Sorry if that seems unclear, I am basically looking for a way of
referencing the TimeSheetID in the DataGrid when performing my update
stored procedure. The TimeSheetID is not editable.
I tried
myCommand.Parameters["@TimeSheetID"].Value =
e.Item.Cells[4].Controls[0];
however this returned the "System.ArgumentOutOfRangeException:
Specified argument was out of the range of valid values. Parameter
name: index" error message.
For info my DataGrid is bound to DataView4 as Data Source, with a
RowFilter
Any suggestions on how to do this?
Thanks
Al Tag: Calling DB2 Stored Procedure with Parameters Tag: 127943
Copy a DataTable
Hi,
I'm running code that creates a new datatable based on filtered
datatable. My code uses the Select method to filter the data and loops
throw each row to copy its contents to the new datatable. My question
is, is there a better/faster method of performing this task, rather
than looping through the datatable?
Thanks in advance,
Roger Tag: Calling DB2 Stored Procedure with Parameters Tag: 127939
.NET Provider for DB2 8.2.1
Hi, I need to access a DB2 8.2.1 server on AIX64. Normally we access
SQL Server, but I'd like to go directly to the DB2 server with a web
service if possible.
1) is there an IBM .net data provider? if yes, is this the way to go?
2) does the data provider require me to use a license file or anything?
I have a name & password to the server, but another department owns it.
I'm just a user.
3) any opinions about what I want to do? It's pretty simple, I want to
return 100 rows or fewer in XML via the web service.
If you have a link to any code samples or a download link to the
provider that would help greatly!
Thanks! Rusty.
--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com Tag: Calling DB2 Stored Procedure with Parameters Tag: 127931
Listbox / Combobox with multiple fields as displaymember
I need to populate a combobox and/or a listbox with several fields as
displaymember. Both controls allow only one field as displaymember.
I need the display member to look like this (the columns should be left
aligned), where each columns represents a field in the underlying datatable:
001 SomeText 987654321
002 SomeText 1 123456789
003 SomeText 100 321456987
I am using Visual Basic .Net 2005
Can anybody help me with this?
--
Sergio Torres C.
(505) 897 2041
___________________
http://www.stcsys.com
___________________ Tag: Calling DB2 Stored Procedure with Parameters Tag: 127924
Has anyone ever called a DB2 stored procedure using the .Net
OleDbDataAdapter and passed parameters to the stored procedure?
Can you give an example?
Thanks in advance.