dataadapter autoincrement challenge
Hi all,
When I call the dataadapter.Update(datatable) function, the Id column of the
datatable does not get updated with the value generated by Identity colum on
the related database table for new rows.
Is this by design? If so, is there an 'easy' way to update the new row Id
values?
Setting AutoIncrementStep = -1 resolves any conflict with existing Ids but I
still don't get the new Id.
I know you can use Select @@ Identity to manually update the Id but this
doesn't work when the datatable contains multiple new rows unless you loop
through each new row and update one at a time :-(
Seems like something the dataadapter should handle?
Derek Tag: keyboard layout Tag: 70985
Help: BindingManagerBase.Current() now working
Looking at this code from my application:
BindingManagerBase bmClient = dgClient.BindingContext
[dgClient.DataSource, "TClient"];
for(int pos = 0; pos < bmClient.Count; pos++)
{
bmClient.Position = pos;
dsBrowz2.TClientRow dr = bmClient.Current as
dsBrowz2.TClientRow;
if (dr.clName.Length > 31)
ws.Name = dr.clName.Substring(0, 31);
else
ws.Name = dr.clName;
}
You can see that I set a BindingManagerBase object with a
datagrid's (dgClient) BindingContext() method. Then
inside the for loop I set a TClientRow object with the
binding manager's Current property. That statement
works. But then in the next line, the dr. object is
throws an exception because dr is undefined. What am I
doing wrong???
Thanks,
Darwin Tag: keyboard layout Tag: 70972
How to return DataSet
Hello:
I'm creating an ASP.Net application. I need to run a method that would
return a DataSet. I'm new to C#, so I have a problem with it.
In VB.Net I just used to write a function like this:
Public Function GetOrders(ByVal sSQL As String) As DataSet
In C# when I try to write something like this:
public DataSet CreateDataset(string sSQL)
{
}
I get an error:
"D:\C#_Projects\connect_class\connect_class\clConnect.cs(16): The type or
namespace name 'DataSet' could not be found (are you missing a using
directive or an assembly reference?)"
How would I do this?
Thank you very much in advance,
--
Peter Afonin Tag: keyboard layout Tag: 70963
DataAdapter Parameter question
I am currently dynamically adding a number of parameters
to a DataAdapter for the SELECT's where clause. The
where clause would actually be better to using a set, as
in "SELECT * FROM TABLE WHERE id IN (...)". Can a
parameter be set up to contain a string of values so that
only one paramter would need to be defined for the
query. Like so: SELECT * FROM TABLE WHERE id IN (@Parm1)
Or do I need to create a parameter for each value in the
set?
TIA,
Darwin Tag: keyboard layout Tag: 70960
Date Logic
Hi
I need help with the logic behind a query.
I am writing a query to select available caravans for my
caravan booking system. The user specifies the date that
they want. I want the SPROC to show the caravans that are
available for that user specified date.
I wanted to know what i should write for my date logic in
my SPROC.
i.e what i have at the moment is.....
WHERE ((dbo.Booking_Table.Arrival_Date NOT BETWEEN
@Arrival AND @Departure) OR
(dbo.Booking_Table.Departure_Date NOT BETWEEN
@Arrival_Date AND @Departure_Date))
Is this ok??
The problem i have with this is that i want to ensure the
whole of the user specified interval @ArrivalDate to
@departureDate does not clash with any part of the
already booked caravans. How can i do this??
SELECT dbo.Caravan_details.Caravan_No,
dbo.Caravan_details.Caravan_Model,
dbo.Caravan_details.Length, dbo.Caravan_details.Beds,
dbo.Caravan_details.[Cost/day]
FROM dbo.Caravan_Inv INNER JOIN dbo.Caravan_details ON
dbo.Caravan_Inv.Caravan_Model =
dbo.Caravan_details.Caravan_Model AND
dbo.Caravan_Inv.Length = dbo.Caravan_details.Length
WHERE (dbo.Caravan_Inv.Caravan_Inv_No NOT IN
(SELECT
dbo.Caravan_booking.Caravan_Inv_No
FROM
dbo.Booking_Details ON dbo.Caravan_booking.BookingNo =
dbo.Booking_Details.BookingNo
WHERE ((dbo.Booking_Details.Dt_of_arrival BETWEEN
@Arrival AND @Departure) OR
(dbo.Booking_Details.Dt_of_departure BETWEEN @Arrival AND
@Departure)))) Tag: keyboard layout Tag: 70957
Serialized dataset bug?
Hello,
It seems that DataTable.Select() does not work correctly
for deleted rows when the DataSet has been serialized.
I have a dataset that I call GetChanges() on and pass the
resulting dataset to the middle tier on a different
machine. In the middle tier I must perform some operations
for deleted rows. I retrieved the deleted rows from the
dataset using the DataTable's Select() method, specifying
the DataRowVersion as Deleted. This works fine when I run
the middle tier in the same process as the client, but
when I use remoting to pass the dataset, the Select method
returns a DataRow array with null items instead of the
deleted DataRows.
Is this a known bug? I couldn't find mention of it
anywhere, other than other people experiencing the same
issue. If it is fixed could someone please tell me what
version of the framework it is fixed?
Thanks for any help,
Rob Tag: keyboard layout Tag: 70956
Update Requires a valid insertcommand when passed datarow collection with new rows
Hi All,
I have a Janus DataGrid(Dot Net) that is bound to a typed dataset. The
dataset is empty. The grid adds rows to the dataset.
When I start to record, I find the "request number and create a datarow and
update the datarow with the request number value:
lblRequest.Text = "New Request number is: " & iSar
Dim dr As dsSupply.SupplyOrderRow
Dim i As Integer = 0
Do
ds.SupplyOrder.Rows(i).Item(0) = iSar
dr = ds.SupplyOrder(i)
dr.RequestNumberPK = iSar
i += 1
Loop Until i = ds.SupplyOrder.Rows.Count
Then I record as follows:
Try
daSupply.Update(ds.SupplyOrder)
Catch ex As Exception
MessageBox.Show(ex.Message, "Insert Order",
MessageBoxButtons.OK)
End Try
I get the following error:
Update Requires a valid insertcommand when passed datarow collection with
new rows
The dataadaptor has a sproc that does the insert. When I call the sproc and
pass the p[arams it all works fine.
Anyone have an idea why it will not work through ADo.NET?
Thanks in advance,
Roy Tag: keyboard layout Tag: 70952
PArent child relationship with ado.net and sql Identity
Hi
I have the follwoing tables:
customer - PRimary - CustomerId
orders - PrimaryKey - orderid, Foriegn key CustomerId
orderdetails - ForiegnKey - orderid
The CustomerID and OrderId are Sql Identity type column.
I am building a dataset with a data relationship between the tables. I am
setting the AutoincrementSeed and AutoincrementSetp to -1, and I am adding
information to the Customer and Order and OrderDetails tables.
How can I update the dataset with all the tables new information? Do I have
to update each table? What about the identity value - the order table needs
the customeId identity value.
Thanks,
Ron Tag: keyboard layout Tag: 70950
Sorting strings as numerics in a DataView
I have a DataSet that gets loaded from an XML file. I
then bind the DataSet to a DataGrid. I want to be able to
sort on some columns, but the columns contain numeric data
that is treated as strings. So for example the order
becomes 1,11,2,22,3,33 instead of 1,2,3,11,22,33. Is
there someway I can set the Sort on the DataView to get a
numeric sort? Any other way to accomplish this?
Thanks. Tag: keyboard layout Tag: 70947
Rollback with ado.net
Hi
I am updating tables using the dataadapter update method.
Lets day that when I am updating table1 all goes well, so then I go to
update table2 and it fails. How can I rollback table1?
Thanks,
Ron Tag: keyboard layout Tag: 70942
using a dataview
Hi everyone,
I am trying to apply a dataview to a grid's datasource,
but it doesn't seem to be working. Here are the codes:
Dim objView as New DataView(odsMembers.Tables("DataTable"))
objView.RowFilter = "Active = " & mActive
e.DataSource = objView
(where mActive = true or false). The sql server equivalent
is bit of course, so I am not sure if I should use true or
false keywords or 1,0.
Again, I am only trying to show rows in the grid that
match this filter, but currently, all of the rows in the
original datatable are stilled being displayed. Have I
done something wrong here? Any feedback would be greatly
appreciated.
Thanks,
Chris... Tag: keyboard layout Tag: 70941
multiple results and datarelations
when the stored procedure or batch SQLs returns records, are the table
having relationships also created between them ? i.e are they having
DataRelations set ?
TIA
-ashish Tag: keyboard layout Tag: 70939
What happens on multiple connections with SQL
Hi
I use Sql 7 for the db.
I have asp.net apps which collocts online transactions.
I have customers, orders, orderdetails.. tables.
I have a DataSet for each table and I change the dataset based on the info
from the user.
Squence: Add to Customers dataset, Add to orders dataset and add to
orderdetails datase. If all is ok then I call each dataset adapter update
method..
In order to fill the order table I need to get the CustomerId - This I am
getting my retreiving the Max(CustomerId) from the Customers table.
My question is that if lets say 200 new customers try to add their
information to the web site, and since for each one of them I use the
Max(CustomerId) to get the new customerId, it is possible that multiple
users will get the same CustomerId, this is because I only updates the
database after the new order and order detail has been processed. What
should I do to avoid this? I don't want to enter a new Customer if for
example the order orderdetails dataset addrow method fails. Thats why I am
wating until I add the rows to all tables.
Thenka,
Ron Tag: keyboard layout Tag: 70937
ForeignKeyConstraint [foo] requires child value (x) to exist in the parent table.
re: topic - yeah, i know!
and it _does_ exist in that table!!! so why does this thing keep throwing
an exception?
i don't know the direct answer, but i know the indirect answer: because my
child table uses a composite PK! if i try this exact scenario using a
dataset where the child table's primary key is simple, everything works as
expected.
i'm not sure if it makes a difference that the FK field is also a member of
the composite PK
anyway, i am about to go hack this into shape via workaround: abolish
composite keys in child tables and replace with a surrogate simple key (ie -
an autonumber field, since the identities created by my previously defined
composite key are about to go out the window...)
...but i stopped in to wonder: has anyone else seen this behaviour? is it
a bug, or 'other'? Tag: keyboard layout Tag: 70935
OracleConnection and the Oracle Client installation
I have downloaded and installed OracleClient from msdn, but still I have
difficulties connection to a remote oracle server. I have not installed the
Oracle Client installation from Oracle.
Do I really need to do so to connect to an oracle database?
In java all you need is a small zip/jar file. Installing Oracle Client seems
a bit too much, and kind of an over kill to me?
Morten Tag: keyboard layout Tag: 70934
PDC question
Unfortunately it looks as though I just missed the PDC for this year.
However, I would like to get information on its location/cost for next year
so as to get it in the budget. Does anyone know where to find this? (All I
have been able to locate is info related to the October show?
I would also like this same info for TechEd if anyone has it. Tag: keyboard layout Tag: 70931
The root element is missing when binding dataset to xml textreader
This is a multi-part message in MIME format.
------=_NextPart_000_0037_01C3A780.6EE575D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
cross posted to microsoft.public.dotnet.xml
Hi,
I am attempting to create a xml file to a memory stream the bind it to a =
dataset. I can write a physical file with no problem. However I =
recieve the following error when trying to bind it to a dataset:
Exception Details: System.Xml.XmlException: The root element is missing.
Here is my code:
MemoryStream ms =3D new MemoryStream();
XmlTextWriter xmlWriter =3D new XmlTextWriter(ms, Encoding.UTF8);
xmlWriter.WriteStartDocument();
xmlWriter.WriteStartElement("menu");
xmlWriter.WriteStartElement("menuItem");
xmlWriter.WriteElementString("text", "NewArticles");
xmlWriter.WriteEndElement();
xmlWriter.WriteEndElement();
xmlWriter.WriteEndDocument();
xmlWriter.Flush();
ms.Position =3D 0;
XmlTextReader xxx =3D new XmlTextReader(ms);
DataSet ds =3D new DataSet();
ds.ReadXml(xxx); <------------- Error here
ms.Close();
Menu1.DataSource =3D ds;
Menu1.DataBind();
Source Error:
Line 43:
Line 44: DataSet ds =3D new DataSet();
Line 45: ds.ReadXml(xxx);
Line 46: ms.Close();
Line 47:
Source File: c:\inetpub\wwwroot\ipass\header.ascx.cs Line: 45
Stack Trace:
[XmlException: The root element is missing.]
System.Xml.XmlTextReader.Read() +876
System.Xml.XmlReader.MoveToContent() +75
System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving)
System.Data.DataSet.ReadXml(XmlReader reader)
iPass.header.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\ipass\header.ascx.cs:45
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Page.ProcessRequestMain() +731
------=_NextPart_000_0037_01C3A780.6EE575D0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1264" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>cross posted to=20
microsoft.public.dotnet.xml</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Hi,<BR><BR>I am attempting to create a =
xml file to=20
a memory stream the bind it to a dataset. I can write a physical =
file with=20
no problem. However I recieve the following error when trying to =
bind it=20
to a dataset:<BR><BR>Exception Details: System.Xml.XmlException: The =
root=20
element is missing.<BR><BR>Here is my code:<BR><BR>MemoryStream ms =3D =
new=20
MemoryStream();<BR>XmlTextWriter xmlWriter =3D new XmlTextWriter(ms,=20
Encoding.UTF8);<BR><BR>xmlWriter.WriteStartDocument();<BR>xmlWriter.Write=
StartElement("menu");<BR>xmlWriter.WriteStartElement("menuItem");<BR>xmlW=
riter.WriteElementString("text",=20
"NewArticles");<BR>xmlWriter.WriteEndElement();<BR>xmlWriter.WriteEndElem=
ent();<BR>xmlWriter.WriteEndDocument();<BR>xmlWriter.Flush();<BR>ms.Posit=
ion=20
=3D 0;<BR><BR>XmlTextReader xxx =3D new XmlTextReader(ms);<BR>DataSet ds =
=3D new=20
DataSet();<BR><BR>ds.ReadXml(xxx); <------------- Error=20
here<BR><BR>ms.Close();<BR>Menu1.DataSource =3D=20
ds;<BR>Menu1.DataBind();<BR><BR>Source Error:<BR><BR>Line 43:<BR>Line =
44:=20
DataSet ds =3D new DataSet();<BR>Line 45: ds.ReadXml(xxx);<BR>Line 46:=20
ms.Close();<BR>Line 47:<BR><BR>Source File:=20
c:\inetpub\wwwroot\ipass\header.ascx.cs Line: =
45<BR><BR>Stack=20
Trace:<BR><BR>[XmlException: The root element is =
missing.]<BR> =20
System.Xml.XmlTextReader.Read() +876<BR> =20
System.Xml.XmlReader.MoveToContent() +75<BR> =20
System.Data.DataSet.ReadXml(XmlReader reader, Boolean=20
denyResolving)<BR> System.Data.DataSet.ReadXml(XmlReader=20
reader)<BR> iPass.header.Page_Load(Object sender, EventArgs =
e)=20
in<BR>c:\inetpub\wwwroot\ipass\header.ascx.cs:45<BR> =20
System.Web.UI.Control.OnLoad(EventArgs e) +67<BR> =20
System.Web.UI.Control.LoadRecursive() +35<BR> =20
System.Web.UI.Control.LoadRecursive() +98<BR> =20
System.Web.UI.Control.LoadRecursive() +98<BR> =20
System.Web.UI.Page.ProcessRequestMain() =
+731<BR><BR><BR><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_0037_01C3A780.6EE575D0-- Tag: keyboard layout Tag: 70930
Oracel 9.2.0 and ADO.Net
When I run a web service against an Oracle 9.2.0 database
I get message from the web service that it can not load
the DLL OCI.DLL (the oracle dll). However, I know the DLL
exists and that it can be found in the path.
When I run the same web services with a 8.1.7 database and
OCI.dll or a 9.0.1 database and OCI.dll everything works
great.
Why can't I get the .Net framework 1.1 to recognize the
Oracle 9.2.0 dll. I have used depends.exe to make sure
all required components can be found. Everything seems OK.
Any suggestions or assistance would be appreciated. Tag: keyboard layout Tag: 70929
datepicker!
I need to use a datepicker control in my aspx application.
Do we have one in Visual Studio.Net? If we do how do I use
it?
Thanks Tag: keyboard layout Tag: 70928
Getting a dataset into excel
Hi
I have a pivot table that gets it data from another worksheet in the
workbook.
I need to update the data worksheet from data in a database (I'm using MS
Data Application Block) and get a dataset with the data in it.
I need to know how to open the workbook, delete all the data in the data
worksheet, update the data worksheet from the data in the dataset and then
allow the user to download the new excel workbook.
Anyone have any ideas on how to do this?
Thanks
Bernard
P.S. I've tried the standard 'set response headers to excel and render
datagird', but that doesn't allow me to have another worksheet with my pivot
table. Tag: keyboard layout Tag: 70925
Single Row Insert
I've written the following function to insert a single row
into a database. Here is the code:
public virtual int singleInsert(string tableName, params
IDbDataParameter[] values)
{
if(ConnectionString == "" || ConnectionString.Length == 0)
throw new InvalidOperationException("The connection
string is not set. Set the 'ConnectionString' member.");
if(values == null || values.Length == 0)
throw new ArgumentNullException("values", "The values
array was null or empty. You must pass value(s) to be
inserted.");
DataSet ds = new DataSet(tableName);
// returns a data-provider specific dataAdapter
IDbDataAdapter dataAdapter = GetDataAdapter(tableName,
ConnectionString);
// set the DA's insertCommand object using a
data-provider specific CommandBuilder
dataAdapter.InsertCommand = GetInsertCommand(dataAdapter);
dataAdapter.FillSchema(ds, SchemaType.Source);
DataRow newRow = ds.Tables["Table"].NewRow();
foreach(IDbDataParameter param in values)
{
if
(ds.Tables["Table"].Columns.Contains(param.ParameterName))
newRow[param.ParameterName] = param.Value;
}
ds.Tables["Table"].Rows.Add(newRow);
return dataAdapter.Update(ds);
}
A couple of questions ...
1 - How does the code look as far as scaling goes? Are
there any table locks occuring? (DataTable.NewRow()??)
2 - Any comments or suggestions on the code? Tag: keyboard layout Tag: 70924
Common base class for DataAdapters, CommandBuilders
Can anyone at MS tell me why there is no base class or
common interface for the various CommandBuilder classes in
ADO.NET? Their method signatures are virtually identical,
and it seems like it would be trivial to create a generic
interface (using IDbCommand) that all of the various
implementations consume. As it stands, I am having to
write ugly code in a generic data access class to check
which specific type of command builder I have, rather than
referencing a common interface.
On a related note, can anybody tell me why the
IDbDataAdapter interface does not include several of the
properties of the DbDataAdapter base class? Examples
include 'AcceptChangesDuringFill', 'ContinueUpdateOnError',
and some generic version of the RowUpdating and
RowUpdated events. In the same generic data access class,
I need to cast between IDbDataAdapter and DbDataAdapter to
access these properties, and I need to cast to specific
data adapter classes to access the RowUpdating and
RowUpdated events.
It seems that the framework is 90% there in providing
generic data access, but falls short in these two areas.
Is there a compelling reason why this shortfall exists, or
can somebody at MS get this into .NET 1.2?
John Bledsoe
ATGi Tag: keyboard layout Tag: 70923
RE: NVarchar in ORACLE
Hi Folks
For OracleClient
===========
I hve a table with only one NVarChar2 column. and i tried to insert the
following query but the values are not inserted in Unicode why. But when i
use Parameters collection it works.
String strQuery ="Insert Into TestTable(Col1) Values('" + txtCode.Text +
"')")
cmd.ExecuteNonQuery(strQuery)
I would like to know how the insert query is fired by MS.
Prasad Tag: keyboard layout Tag: 70922
format ? in ADONET?
In VB using DAO, I was able to use format function to query the database. In
ASP.net using MS SQL server, I cannot use format function. What is the
function that I can use to get the desire result?
Here is an example SQL statement that I did in DAO.
Select FORMAT(flddate, 'mm yyyy') as tdate, sum(fldtotal) as ttot
From tbl
Group by FORMAT(flddate, 'mm yyyy')
Order by FORMAT(flddate, 'mm yyyy')
--
----------------------------------------------------
This mailbox protected from junk email by Matador
from MailFrontier, Inc. http://info.mailfrontier.com Tag: keyboard layout Tag: 70920
multiple resultsets via DataAdapter ?
Hi all,
i have discussed this topic on the news group before, and found it very
helpful, now that iam implementing something, i see some problems,
iam trying execute a stored proc on SQL Server, and trying to get
multiple resultsets,
Iam using the oledbdataadapter class's fill method, the data tables are
all created correctly but none of them are having any results in them,
except the first one ,although i know other tables are having rows in them,
i have seen examples in Bill Vaugh's paper, using DataReader, can i do
the same using DataAdapter ?
any help ,pointer would be appreciated
thanks
-ashish Tag: keyboard layout Tag: 70919
DAL for ORACLE
Anyone knows a DAL implementation for ORACLE 8i
I could find a lot of DALS for sqlserver but not for oracle
thanks Tag: keyboard layout Tag: 70918
Alternatives to databinding
I think I'm going to abandon using databinding in my windows forms project
because it simply doesn't work as well as it ought to. There are simply too
many road blocks and too much odd are poorly documented behavior to be worth
my time any more. I patched up and worked around so many of the oddities in
framework that I don't even feel like I still in control of the code
anymore. So I'm ditching it (*I think*).
Now I need to work out an alternative scheme for getting data from my
datasource into the controls on my form and back again, so my question is
does anybody know of any good articles or tutorials on this subject. I want
to try and make sure I've considered everything before I start what might be
a major undertaking so I can decide on the most elegant and flexible
solution.
Cheers
Matt Tag: keyboard layout Tag: 70917
best practices for cleaning up connections, commands and transactions after errors occur?
I would like people's opinions on how best to clean up SQL Server
connections and transactions after errors occur while using them. For
example, assume you have the following:
Public Function test()
Dim conn As New SqlClient.SqlConnection("connection string here")
Dim cmd As New SqlClient.SqlCommand("MyStoredProc", conn)
Try
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
Catch ex as Exception
' Possibly do something more than rethrow.
throw ex
Finally
conn.Dispose()
cmd.Dispose()
End Try
End Function
Now let us assume that ExecuteNonQuery() throws a SQL Exception.
1. After the exception, should I still try to call Close() on the connection
in the Catch block?
2. If the answer to #1 is yes, shouldn't one rather move the Close() to the
finally block where it will always be called?
3. Is there a chance that calling Close() will itself throw an exception -
either within the finally or catch blocks?
At the end of the day, what is important is to ensure that this connection
is returned to the connection pool as quickly as possible no matter what the
outcome of the function call.
Thoughts and ideas would be appreciated.
Andrew Tag: keyboard layout Tag: 70916
New to .Net - help!
I want to access a database from a web page but looking at
examples in books it's always for the SQL server. I'm
using Access. The examples use the server explorer and
toolbox data to gain access to the database(sqlconnection)
and the sqldataadapter to extract data from the database.
When I use the equivalent for access (oledbdataadapter and
oledbconnection) it doesn't work. If I write my own code
then I can get it to work.
I know I can solve this by just writing my own code but if
there are "tools" that produce the code then I'd like to
get these to work.
What's the best way of going about this?
Thanks in advance Tag: keyboard layout Tag: 70915
How to have two-way cursors, dynaset, the CRecordSet like features
[SUMMARY]:
I am basically trying to write class[es] that shall wrap the
consummate DB access code much like
Visual C++ CRecordSet including two-way cursors, dynaset, multi-table
read-only query including
two-way read-only scrolling etc among others.
[DETAILS OF QUERY]:
Slightly faultered across the multitude of .NET DB classes to work
with in short span.
Can somebody tell me as to how I shall be able to create using .NET
namespaces following
proposition:
1> Two way read-only scrollbale cursor that is fetching data from two
tables [upon a simple WHERE
clause]
I thought about going through SqlDataAdapter's Fill() method that
shall fill up the DataSet with
fetched rows. But it seems from docs that DataSet shall fill both of
the tables in query 'separately'
with results and relations. I just want CRecordSet's View-like
scrollble rows [with combination of
selected fields from both tables].
2> Dynamic cursor that is scrollable across either direction and is
spanned across a single table query
I looked into higher end version of SqlDataReader but did not find
any. So do I have to go through
DataSet's Fill and then operate on individual DataRows for my updates
etc before 'reconciliation'?
Kindly let me know.
Thanks for your time.
- KA Tag: keyboard layout Tag: 70911
Passing an array to Oracle procedure's parameter
Hello.
Is there any way to pass an array to an Oracle procedure's
parameter? (I am using System.Data.OracleClient classes).
Thanks in advance.
Celio C. J. Tag: keyboard layout Tag: 70905
Permission to access database problem
Hi
When I try to connect to the database I'm getting the
message that the database file cannot be opened because
"It is already opened exclusively by another user, or you
need permission to view its data."
This appears on the web page since this is how I'm trying
to view data.
I know no-one else has the database open so therefore I
need to set up the database so that permission is allowed
to access data. It's an Access database. How do I go
about doing this?
Thanks in advance Tag: keyboard layout Tag: 70904
XMLHTTP in ASP.NET
Hi,
Do we have any replacement of XMLHTTP in ASP.NET. If yes,
could anybody plase give an example of sending a xml
island from client to server and recieving the island at
server.
Thanks in advance.
regards,
mk Tag: keyboard layout Tag: 70891
queries across multiple tables
Hi All,
I need to make a sql query build which needs to do the following :
- span across 20-30 tables
- Filters
- provide a UI (end user would use this)
So the idea is that the end user can pickup any field from any table and
apply some conditions (filters) to it and then retrieve the resulting
data --- fields that make up the resulting data can also be defined by the
end user.
Does anybody have any suggestions on how this can be implemented ?
thanks, Tag: keyboard layout Tag: 70884
Is there a published COM Interop Wrapper for Interop.MSDASC.dll?
Is there a published COM Interop Wrapper for
Interop.MSDASC.dll, and if so where is it in MSDN or
otherwise to download?
Dear Authorities:
I would like to us the MSDASC.DataLink
(Interop.MSDASC.dll) in a .Net application.
In doing this I am trying to add a reference to
the 'Microsoft OLE Db Service Component 1.0 Type
Library'. When I attemp to add it, I get this error
message:
"A reference to 'Microsoft OLE Db Service Component 1.0
Type Library' could not be added. Coverting the type
library to a .Net assembly. Access to the
path "C:\Program
Files\Word\Samples\C#\NewAccessMaintenanceCSharp\obj\Intero
p."
When I click the Help button on this Error message, I get
this additional message:
"You can also search the MSDN Web site for a COM interop
wrapper that has been published for your specific COM
component."
I searched MSDN for MSDASC.dll as a published COM Interop
Wrapper and found nothing. Do any of you know if there is
such a published Wrapper, and if it does exist, where I
could download it. Better yet, if you have one could you
please send it to me.
Sincerely,
Burton G. Wilkins Tag: keyboard layout Tag: 70883
SPROCS
Hi,
I wanted to know how i can call stored procedure and pass
it 2 parameters when a button is clicked.
my code for the stored procedure is:
INSERT INTO Available_Meals(Meal_desc, Cost) VALUES
(@Meal_desc, @Cost);
SELECT Meal_desc, Cost FROM Available_Meals WHERE
(Meal_desc = @Meal_desc)
any help would be excellent.
Also does anyone know why the sprocs i create do not
appear straight away the the server explorer? I have to
close VS.net down and then reopen the project to make
them visible. Tag: keyboard layout Tag: 70882
Insert Data from a User Created DataSet?
Hi All,
I am trying to do the fowoing:
1. Create a DataSet (no problem here) Code below:
'-----------------------------------Create DataSet
Dim myDS As New Data.DataSet("CIRCUITS")
Dim myCircuits As Data.DataTable = myDS.Tables.Add("CIRTBL")
Dim myDr As Data.DataRow
With myCircuits
.Columns.Add("CircuitBucket", Type.GetType("System.String"))
.Columns.Add("CircuitType", Type.GetType("System.String"))
.Columns.Add("SiteID", Type.GetType("System.String"))
.Columns.Add("SiteIDB", Type.GetType("System.String"))
.Columns.Add("Requestor", Type.GetType("System.String"))
.Columns.Add("Provisioner", Type.GetType("System.String"))
End With
'-----------------------------------Populate DataSet
For Each lvNode In lv.Items
myDr = myCircuits.NewRow()
myDr("CircuitBucket") = lvNode.SubItems(45).Text
myDr("CircuitType") = lvNode.SubItems(46).Text
myDr("SiteID") = lvNode.SubItems(39).Text
myDr("SiteIDB") = lvNode.SubItems(40).Text
myDr("Requestor") = lvNode.SubItems(41).Text
myDr("Provisioner") = lvNode.SubItems(42).Text
myCircuits.Rows.Add(myDr)
Next
2. Now I want to insert the data using a Stored Procedure (SQL)
'-----------------------------------INSERT DataSet
cnS = New SqlConnection(cnMAIN$)
cnS.Open()
Dim SQLCMD As New SqlCommand
SQLCMD.Connection = cnS
SQLCMD.CommandText = "SELECT * FROM myTable"
SQLCMD.CommandType = CommandType.Text
daS = New SqlDataAdapter
daS.SelectCommand = SQLCMD
daS.Fill(myDS, "myTable")
Dim cmdINSERT As New SqlCommand("usp_INSERT_CIRCUIT")
cmdINSERT.CommandType = CommandType.StoredProcedure
cmdINSERT.Parameters.Add(New SqlParameter("@CircuitBucket",
SqlDbType.VarChar, 10, "CircuitBucket"))
cmdINSERT.Parameters.Add(New SqlParameter("@CircuitType",
SqlDbType.VarChar, 10, "CircuitType"))
cmdINSERT.Parameters.Add(New SqlParameter("@SiteID",
SqlDbType.VarChar, 100, "SiteID"))
cmdINSERT.Parameters.Add(New SqlParameter("@SiteIDB",
SqlDbType.VarChar, 100, "SiteIDB"))
cmdINSERT.Parameters.Add(New SqlParameter("@Requestor",
SqlDbType.VarChar, 100, "Requestor"))
cmdINSERT.Parameters.Add(New SqlParameter("@Provisioner",
SqlDbType.VarChar, 100, "Provisioner"))
daS.InsertCommand = cmdINSERT
cmdINSERT.Connection = cnS
My problem here is definatly, and at leaset, the SelectCommand is failing
with an error stating that it does not know what the Table object supplied
is. In the above example it is myTable. I don't even need a select command
because I am inserting only; but I get an error if I exclude the
SelectCommand.
The reason I am doing this is that I need to pass the data into a stored
procedure that will in turn decide which Insert statement to use based on
the @CircuitBucket Parameter.
Any ideas regading the proper way of dealing with this please help.
Thanks,
John. Tag: keyboard layout Tag: 70877
plz help. SQL problem
hi,
I have 2 comboboxes (CB). CB1 shows the roomNames (pulled
from my access DB) and CB2 should show the layouts that
are possible (RoomLayout) for that specifc room (these
values are also stored in the database, but in a
different table). What i want to do is load the correct
layouts for a particular room into CB2 (from my DB) based
on the room selected by the user in CB1. This requires me
to requery the database everytime the value of CB1 is
changed. The problem im having is that CB2 does not seem
to be populating.
Heres my code:
Private Sub Form2_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
''''this loads CB1 with the room names
DsRoomN1.Clear()
OleDbDAdapterRoomN.Fill(DsRoomN1)
End Sub
Private Sub CB1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CB1.SelectedIndexChanged
Dim ObjParam As OleDb.OleDbParameter
ObjParam =
OleDbDAdapterPL.SelectCommand.Parameters.Add("@RoomNm",
OleDb.OleDbType.Char)
DsPossLayouts.Clear()
OleDbDAdapterPL.Fill(DsPossLayouts)
the query that i wrote in the query builder for CB2 is:
SELECT Room_Layouts.Poss_layout, Rooms_avail.Room_name,
Room_Layout.RoomID, Rooms_avail.RoomID AS Expr1 FROM
Room_Layouts INNER JOIN Rooms_avail ON
Room_Layouts.RoomID = Rooms_avail.RoomID WHERE
(Rooms_avail.Room_name = ?)
the question mark is the parameter that will need to be
inserted from CB1 (i.e the room_name).
Can anyone help me figure out how to make this work?
thx in advance Tag: keyboard layout Tag: 70863
ADODB.Stream to .Net Streams
Does anyone have an efficient way of converting an ADO
Stream object into a .NET stream object? For security
reasons, I'm not allowed to create a temporary file, so
just using memory streams would be more appropriate.
Thanks in advance!
Thanh Tag: keyboard layout Tag: 70860
ADO.net Book recommendation
Hi,
can anyone recommend a good ADO.net book that is suitable
for beginners.
I need help in creating my standlone windows
application.As i am using an access database the example
have to be suitable for this and not just SQL server
(Like most other books).
All the books i have so far show the code that goes into
a console application with a connection to sql server
dbms. :o(
Any recommendations?? Tag: keyboard layout Tag: 70859
size of table in memory - sql server 2000, xp pro, vb .net
This is a question for sql server 2000 and vb .net and xp pro, so I am
posting to all ng's.
Is there any way of knowing or approximating the amount of memory exhausted
in retaining a large disconnected (ado .net) table/dataset? It a .dbf file
is in memory, I could identify the size of the file directly, but with sql
server 2000 and the swapping technologies of windows xp pro, I only know the
size of the .mdf, which is of no value. Say the .mdf is 4.6 gig and it
contains 160 tables, 200 sp's, a few view, triggers, etc. One table - a
large one - has 25 cols and 1.2 million rows. Its physical size is no where
designated. I load this in a vb .net app into a dataset. It takes a long
time, obviously.
But once loaded, approx how much memory has been used? Did it write xml and
is it continually swapping out to get the appropriate xml and then display
it, allow changes to it, etc?
Tx for any help.
Bernie Yaeger Tag: keyboard layout Tag: 70858
ANN : Klik! CompareLib v1.0.7 has been released...
09/11/2003 - Klik! CompareLib v1.0.7 has been released...
Klik! CompareLib is a tool which compares and sychronizes the structural
differences in your MSAccess 97/2000/XP databases. It's simple and yet
detailed wizard style interface will allow you to compare, make deep
analysis and generate the merge scripts to make the compared databases
structures equal. A script applying tool, ScriptRunner, is included with the
package to easily apply the generated scripts later...
With this new version all known merge script issues has been resolved and
added new options on how to do the comparison...
For more information about Klik! CompareLib, just visit us at
http://www.kliksoft.com ...
Best Wishes,
Klik! Software Tag: keyboard layout Tag: 70857
this namespaec
does this provider namespace use EDI format to communicae
with the sql server or does it use XML to transfer data Tag: keyboard layout Tag: 70854
Datasets and null values
Hi,
When I set the nillable value to true of a string column
in a dataset, the VS.NET project does compile.
But when I want to set nillable true of a short column,
the project doesn't compile.
How can I get a short column of a dataset set to NULL?
thanks for any answers
Filip Tag: keyboard layout Tag: 70852
Constraint with Expression DataColumn
Hi,
I have 3 datables (TableA, TableB,TableC).
I create a DataRelation with TableA and TableB and I add a DataColumn into
TableB where I stock a parent field called idkey
I try to create a DataRelation using TableC with the field idkey and I get a
error like it can't create a constraint using an expression datacolumn.
Do you have some ideas ?
Stan Tag: keyboard layout Tag: 70851