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: How to have two-way cursors, dynaset, the CRecordSet like features 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: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70904
Expression column event
is it possible to get the change event for the expression column. Thanks in
advance. Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70898
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: How to have two-way cursors, dynaset, the CRecordSet like features 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: How to have two-way cursors, dynaset, the CRecordSet like features 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: How to have two-way cursors, dynaset, the CRecordSet like features 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: How to have two-way cursors, dynaset, the CRecordSet like features 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: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70877
Binding group of option buttons to one Dataset column
Hi,
Is it possible to bind a group of option buttons (in win forms) to on
Dataset Column?
Thanks,
Shimon Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70872
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: How to have two-way cursors, dynaset, the CRecordSet like features 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: How to have two-way cursors, dynaset, the CRecordSet like features 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: How to have two-way cursors, dynaset, the CRecordSet like features 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: How to have two-way cursors, dynaset, the CRecordSet like features 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: How to have two-way cursors, dynaset, the CRecordSet like features 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: How to have two-way cursors, dynaset, the CRecordSet like features 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: How to have two-way cursors, dynaset, the CRecordSet like features 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: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70851
DataGrid Scrollbar problem
I've a problem using a datagird, for some reason I keep getting the scroll
bars of the datagrid on top of the grid itself.
Moreover, the window is big enough that I don't need the scrollbars.
It's kind of hard to explain, please look here for example:
http://ayende.freewebspace.com/bad%20datagrid.JPG
This is where I create the tab pages, FillDataTable() fills the datagrid
with rows.
The code that I'm using is:
tp = new TabPage(q.Name);
dg = new DataGrid();
dg.BeginInit();
dg.SuspendLayout();
dg.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
dg.HeaderForeColor = System.Drawing.SystemColors.ControlText;
dg.Location = new System.Drawing.Point(8, 8);
dg.Name = q.Name;
dg.Dock = DockStyle.Fill;
dt = new DataTable(q.Name);
Name = new DataColumn("Name",Type.GetType("System.String"));
Value = new DataColumn("Value",Type.GetType("System.String"));
dt.Columns.AddRange(new DataColumn[]{Name,Value});
FillDataTable(dt,q);
dg.DataSource = dt;
dg.ReadOnly = true;
dg.PreferredColumnWidth = 150;
dg.AllowSorting = false;
dg.CaptionText = q.Name;
dg.ColumnHeadersVisible = false;
dg.RowHeadersVisible = false;
dg.ResumeLayout();
dg.EndInit();
tp.Controls.Add(dg);
QuotesTab.TabPages.Add(tp);
P.S.
How do I make the columns spread on all the screen?
(Actually, I just want the second column to do that.) Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70832
SQL error
Hi,
Im trying to enter a query into the query builder for in
the OLEDBdataAdapter wizard. My query is as follows:
SELECT
a.Caravan_Inv_No,
a.Caravan_Model,
a.Length,
b.Beds,
b.[Cost/day]
FROM
Caravan_Inv a,
Caravan_details b
WHERE
a.Caravan_Inv_No = b.Caravan_Inv_No AND
a.Length = b.Length AND
a.Caravan_Inv_No NOT IN
(SELECT c.Caravan_Inv_No
FROM Caravan_booking c , Booking_details d
WHERE c.BookingNo = d .BookingNo
AND Dt_of_arrival BETWEEN ? AND ?
AND Dt_of_depature BETWEEN ? AND ?)
i keep getting the following error:
Failed to get schema for this query.
does anyone have any idea of what the problem is??
btw, i have used '?' to represent a value that has to be
passed in from 2 of my dtpickers. is this the right way
to write this? (i have an access db)
thx Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70830
Extra coloumns
hi,
i have written a query n the oledbadapter and i keep
getting rows that should not be displayed in my datagrid.
the query is as follows:
SELECT Caravan_Inv.Caravan_Inv_No,
Caravan_Inv.Caravan_Model, Caravan_Inv.Length,
Caravan_details.Beds, Caravan_details.[Cost/day],
Caravan_details.Caravan_Model AS Expr1,
Caravan_details.Length AS Expr2 FROM Caravan_Inv INNER
JOIN Caravan_details ON Caravan_Inv.Caravan_Model =
Caravan_details.Caravan_Model
the additional coloumns are the Expr1 and Expr2. Even
when i delete them from my query, they still seem to show
up in my result.
Why do they appear? I am using the query builder of the
OLEDBAdapter.
thx Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70829
connection string in web.config error
I added the connection string in web.config as follows:
<appSettings>
<add key="connString" value="Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=MY_DATABASE;Data Source=IP_ADDRESS" />
</appSettings>
In mypage.aspx.vb page, I open the connection with connString variable:
Dim conn As New SqlConnection(connString)
But it has compile error:
name 'connString' is not declared.
Any ideas? Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70824
timeout in sp but not in normal select
hi!
I use
- .net framework 1.1
- sql server 2000 sp 3a
- windows 2000 server
- asp.net/c#
- system.Data.SqlClient
- latest sp's & hotfixes
when I use a stored procedure (result 50 rows, execution time 2 seconds,
about 600,000 rows in the table) in a c# code I'll get a "timeout expired"
SqlException.
...
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.CommandText = "sp_x";
myCommand.CommandTimeout = 0;
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
x = myReader["x"].toString(); // <<-- TIMEOUT
}
...
the same sql in a "normal" select statement will work.
...
myCommand.CommandType = CommandType.Text;
myCommand.CommandText = "select x from ...";
myCommand.CommandTimeout = 0;
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
x = myReader["x"].toString(); // <<-- OK
}
...
if I reduce the amount of rows (result about 5 rows, execution time less
than 0.2 seconds, about 10,000 rows in the table) the stored procedure will
work in c#.
but the "large" stored procedure will work with all other softwareproducts
(like ms access, dts wizard, and so on).
thanx for your help
mac Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70823
beginner questions
Hi,
Im new to VB.net and wanted to find out about the best
way to code my connection to my access db.
I wanted to know if it is necessary to place the
connection string and create a new instance of the
olebconnection class on every page that uses a sql
statement.
Is it possible to place this code in a module and then
just use the varible the Conn String is placed in from
all the forms??
What about all the sql statements? can i also code then
in the module and call then whereever the are required in
my application??
Thx for your help Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70816
Execute requires the command to have a transaction object when the connection as
This is the sequence of events :
foo() {
SqlConnection conn = conn.Open();
SqlTransaction tx = conn.BeginTransaction();
... // do something
AnotherModule.bar(conn);
}
AnotherModule.bar(SqlConnection conn) {
SqlCommand cmd = conn.CreateCommand();
.. // calls a stored procedure
..
conn.ExecuteNonQuery(); // <<== Exception here
}
The exception is :-
"Execute requires the command to have a transaction object
when the connection assigned to the command is in a
pending local transaction. The Transaction property of
the command has not been initialized."
Why is it required for the bar() method to know the
transaction. It just wants to re-use the same connection
object. In fact the transaction is handled inside the
stored procedure that it is calling.
The api expects that, in the SqlCommand that is created in
bar() method also set the same transaction that the
connection is using. Why is this required?
I do not want to tie the transaction created in foo() to
the SqlCommand created in bar(). Is not a realistic
situation? What if Im calling a third party stored
procedure?
Looks to me that the the only way it could be solved is by
opening a new connection in bar(), instead of getting the
connection object as a parameter from the caller.
Anybody faced this problem?
- shiv Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70815
parent/child tables and identity problems: a scenario
I'm having strange errors with a C# app using form controls bound to a typed
dataset, which holds a parent-table with a single record and a number of
children tables with many records. As I'm new to ADO.NET, first of all I'd
like to know if I'm doing something wrong in my general approach. Here's a
simplified scenario, it's a bit long but I hope it can be useful to newbies
like me, facing the identity problems when updating a dataset. Thank you
very much for your patience!
(a) I use MSDE and the corresponding SqlClient namespace objects. All the
identity values in my tables are autonumber; in the dataset, autonumber seed
and step are set to -1 after their construction, so that the records added
in the "in memory" dataset will be granted to have a different identity from
any database record.
(b) All the insert commands use an output parameter (@newID) set to the new
identity value, e.g. the T-SQL code looks like:
ALTER PROCEDURE AnInsertCommand
(
...
@newID int OUTPUT
)
AS
INSERT INTO ... ;
SET @newID = SCOPE_IDENTITY()
The corresponding command objects include this @newID in their params
collection and map it to the table primary key field, so that when the
command is executed the dataset table will be updated to hold the "real"
autonumber value assigned by database (thus replacing the negative value
used in-memory).
(c) After generating the dataset, I have manually added the required
required foreign-key relations to it using the VS dataset designer, so that
the parent/child relationship are set up correctly: each primary key in a
child table is linked to the corresponding foreign key in the parent table.
(d) Let's say the parent table in dataset is "Customer", and the child table
is "Country". Customer has a countryID acting as the foreign key to the
Country child table. In my application, the user selects a single customer
to edit, or wants to enter a new customer; the form shows his data in bound
controls, and the data for child tables are typically shown in combo boxes
(e.g. a list of countries the user can select from). Thus, the dataset will
always contain a single parent record (=1 customer) and all the children
records (=countries list). The user can also add new countries when editing
a single customer record.
(e) When data are to be stored into database, the update policy is:
1) call BindingContext EndCurrentEdit for each table in the dataset, e.g.:
BindingContext[myDataSet, "Table Name"].EndCurrentEdit();
2) open the connection to database and begin a transaction
3) call Update for each CHILD table for NEW records only, e.g.:
countryDataAdapter.Update(myDataSet.TCountry.Select("","",DataViewRowState.A
dded));
this inserts the newly added countries only and updates the dataset Country
table so that the autonumber values reflect the "real" (non-negative) values
assigned by database; thus, a countryID = -10 becomes e.g. 67; also, the
relationships I have setup in the dataset cascade this update to the linked
parent table, so that the foreign key -10 becomes 67 too.
4) call Update for the PARENT table for NEW or MODIFIED records only
(deleted records will be processed later);
5) call Update for each CHILD table for all other records (e.g. MODIFIED or
DELETED);
6) call Update for the PARENT table for DELETED records.
7) commit the transaction and call AcceptChanges for the whole dataset.
8) close the connection anyway (in a finally {} block; in the catch{} block
the transaction is rolled back).
Now, this seems to work fine: I edit and add records, and autonumber values
are treated as expected and their changes propagated to the parent as
required. Here's the problem: when I'm editing an existing parent record and
add a new child record (e.g. a new country) and then store data, all works
fine; when I create a NEW parent record and do the same, the Update method
for the child table raises an "Object reference not set to instance of an
object" exception: as far as I can check with the debugger, all the values
in the dataset are as expected: the parent record has a negative ID, as for
the newly added child record, and both are linked correctly
(parent.countryID = child.countryID). As everything works when updating an
existing parent record, I'd expect the code to work for a new record too, as
the only difference is that a new record has a negative ID in the parent
table (which anyway should not matter for updating the child table, which is
linked via a foreign key).
Could anyone tell me if anything is "philosophically" wrong with this
approach? I cannot understand the reason for such errors... Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70808
Why don't DataGrid Use DataColumn.Caption
I found following thread
source :-
http://www.dotnet247.com/247reference/msgs/16/84118.aspx
-----------------------------------------------------------
-----------------
I need to change the caption of a DataColumn and I wrote
this but it doesn't
work
DataSet ds = new DataSet();
sqlDataAdapter1.Fill(ds,"Orders");
ds.Tables[0].Columns[0].Caption = "NEW CAPTION";
dataGrid1.SetDataBinding(ds,"Orders");
instead this code work
ds.Tables[0].Columns[0].ColumnName = "NEW CAPTION";
why ?
thank Paps
-----------------------------------------------------------
-----------------
Hi Paps,
Did you want to change the DataGrid's column caption? When
binding a
DataTable to DataGrid, it will use the ColumnName of a
dataColumn as its
column caption in DataGrid.
Luke
-----------------------------------------------------------
-----------------
Hi Luke
So if I need to change the DataGrid column Caption I need
to change the
DataSet.Tables[0].Columns[0].ColumnName and not the
Caption ?
But in this way I loose consistence with my dataSoruce ?
Thanks Paps
-----------------------------------------------------------
-----------------
Hello Paps,
There seems to be an issue with datagrid where it does not
use the caption
property to set the header text for the columns.
I was able to get around that by creating my own
datagridtablestyle and
datagridcolumnstyle and setting the headertext properties.
Dim ts1 As New DataGridTableStyle()
ts1.MappingName = "Items"
Dim TextCol3 As New DataGridTextBoxColumn()
TextCol3.MappingName = "Description"
TextCol3.HeaderText = "Item Description"
TextCol3.TextBox.ForeColor = System.Drawing.Color.Brown
TextCol3.Width = 150
ts1.GridColumnStyles.Add(TextCol3)
MyDataGrid.TableStyles.Add(ts1)
Hope this helps.
Ramesh Thyagarajan
Microsoft Developer support
-----------------------------------------------------------
------
However there is lot of headache if we have to use
DataGridTableStyle to save changing the DataColumn's
column names. If there are lot of grids in project which
is very common situation this is really cumbersome task.
Also there is maintenance issue, simple addition or
removal of some column in display compels you to work on
both DAL and GUI layer. Can we avoid this in some decent
way so that we get best of both worlds, I mean I don't
need to loose the consistency of column names with
datasource while using DataColumn and also I don't need to
do extra work IN GUI layer. Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70804
how to get column name for a table in MS-Access?
Hi,
Does anyone know how to get column names for a specific table in Access?
For Sql Server, if I need to get column names for a specific table, I can use SQL statement "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = *"; I wonder how if there is a similiar way to achieve the same in Access?
Thanks for your help in advance! Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70802
How do I implement a "SELECT DISTINCT" equivalent?
Hi.
I have a dataset which is the result of a merge operation from several
source datasets (via the Merge method). Problem is that I dont control the
source datasets and I need to ensure that I dont get duplicate results in
the final (merged) dataset. I have a primary key on a columns on the tables
in all datasets so I can enforce a constraint on that. However, I want to
prune the results of duplicates, rather than failing outright. Effectively,
I want the equivalent of a "SELECT DISTINCT" SQL statement.
How do I do this? How do I quickly prune duplicate results to return only
distinct rows?
Thanks!
-Danny- Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70798
Problems with ADO.NET Core Reference Code
All,
I'm developing a database system similar to the example show in
Chap 13 (Step 10) of David Sceppa's excellent ADO.NET book. However,
I'm having a problem with my code, and the same error is popping up in
the example code. In the example, I can add a new Order, then when I
attempt to add details to the order, I get an "Exception: Column
'ProductID' does not allow nulls." Exception. I'm not sure how to fix
this situation... Any thoughts?
Thanks,
Jeff Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70788
Query and variables help.
Hi,
I wanted to know how i can pass varibales from my vb.net
interface to my Access xp database??
What i want to do is use the date selected by the user
from 2 dtpickers and use these in my OLEDataAdapter query.
(I dont know what to type in in the OLEDataAdapter query
builder).
what do i write in my query to represent these variables
in my query??
what i want to write a query that selects the rooms that
are not booked withing the date period specified by the
user.
I have 3 tables that i may need to use:
Room Details (a descrption of all the rooms in the hotel):
RoomNo
RoomName
Room Booking (a link table to handle the M:N
relationship):
RoomNo
BookingNo
Booking Table (Contains details of the guest and his
booking details):
BookingNo
DateOfArrival
DateOfDeparture
Can anyone plz help me with this. Iv been stuck for
ages :o( Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70787
ConcurrencyViolation Error.... Driving me nuts!
This is more of an plea for help question. Before I go
into details, I am using Windows 2k, VS 2003, MySql Server
and an open source MySql .NET driver (MySqlDriverCS). (I
am aware that the fact that I am using an open source
driver could be the cause of my error).
I have checked many message boards about my error and have
found that people using Access, SQL Server, MySql, Oracle
all get this error and for similar reasons.
Error: Concurrency violation: the
DeleteCommand affected 0 records.
I receive the exception whenever I call the
DataAdapter.Update() method after marking DataTable Rows
for deletion.
My DeleteCommand.Text = "DELETE FROM mynames WHERE ID =
@ID"
I delete the Row, but doing a:
Dim key as new Integer(whatevermykeyis)
row = myTable.Rows.Find(key)
row.Delete()
Sometimes the row will be deleted from my Database,
sometimes it wont, but I still get the error no matter
what happens. After I get the exception I cannot do
anything else in my app and am forced to restart it.
What I believe could be the reason:
When add Parameters to mySqlCommands, I cannot add a size
property. Also, the datatypes do not properly match up
with MySql database types. In my database I used a
SmallInt(4) for my ID Column data type. But when I add
the parameters to my DeleteCommand, the best I can come up
with is DBType.Int16 (which is a 5 digit number).
Things I have tried:
1. Changed Database to NOT use a ID field and use a
varchar(16) field.
2. Changed my deleteCommand parameters from almost every
datatype I could, Int16, Int32,...
3. Changed my DeleteCommand String.
4. Many other changes to my code...etc
No matter what changes I do, I've always gotten that
exception. Can anyone fill me in, or give me some ideas
to try out. My database data doesnt change from the time
I Fill my DataSet to the time I Update my Database.
Thanks,
Dan Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70785
sqldatareader.read() is false with breakpoint
I have the following code:
if (SqlDR != null)
{
while (SqlDR.Read())
{
feed indexfeed = ReturnInstance();
indexfeed.FeedID = new Guid(SqlDR["ID"].ToString());
m_feedarr.Add(indexfeed);
}
}
When i put a breakpoint on (or before) the while line (SqlDR.Read()) the
code will not step inside the while loop, and the Watch window shows the
SqlRD.Read() as true. As soon as I reach that line and step into the next
line, the SqlRead.Read() turns to false and skips over the entire while
loop.
If I put the breakpoint in the while loop, the execution will actually stop
at the breakpoint in the loop.
The question is, why is it that I cannot put a breakpoint before the .Read()
on the while loop and step into the loop, but I can put a breakpoint inside
the while loop and hit the breakpoint on the same queries?
TIA Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70782
System Error Executing CREATE PROCEDURE Script with SqlCommand
I've searched for limitations of the SqlCommand object with regard to
what is valid SQL syntax. Any scripts I have with the GO batch
command don't work unless I remove the GO statement. This is easily
done. However, I used the VS.NET "Generate SQL Script" command to
create a DDL script for a stored procedure I wrote, and it blows up
with a SqlException whose details are simply "System error."
To troubleshoot, I've stripped the stored procedure down to things
I've seen work elsewhere, and I still get the same error. Can someone
please shed some light on what's going on. The text of the stored
procedure is below. Any help would be greatly appreciated.
Thanks,
Marvin
-------------------------------------
-------------------------------------
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[get_next_unique_id]') and OBJECTPROPERTY(id,
N'IsProcedure') = 1)
drop procedure [dbo].[get_next_unique_id]
GO
CREATE PROCEDURE get_next_unique_id
@TableName VARCHAR(50)
AS
/******************************************************************************
** File: get_next_unique_id.sql
** Name: get_next_unique_id
** Desc: This procedure returns the next unique id for the primary
key
** field of the given table.
** Auth: Marvin S. Addison
** Date: 4/5/2003
*******************************************************************************/
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
BEGIN TRANSACTION
/* Initialize counters if necessary */
DECLARE @record_count INT
SELECT @record_count = COUNT(*) FROM UniqueIds
IF @record_count = 0
BEGIN
DECLARE curUsrTables CURSOR
FOR
SELECT name FROM dbo.sysobjects WHERE OBJECTPROPERTY(id,
N'IsUserTable') = 1
OPEN curUsrTables
DECLARE @name VARCHAR(50)
FETCH NEXT FROM curUsrTables INTO @name
WHILE @@fetch_status = 0
BEGIN
IF @name <> 'UniqueIDs' AND @name <> 'dtproperties'
INSERT INTO UniqueIDs (TableName, UniqueID) VALUES (@name, 0)
FETCH NEXT FROM curUsrTables INTO @name
END
CLOSE curUsrTables
DEALLOCATE curUsrTables
END
UPDATE UniqueIDs SET UniqueID = UniqueID + 1 WHERE
TableName=@TableName
SELECT UniqueID FROM UniqueIDS WHERE TableName=@TableName
COMMIT TRANSACTION
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70780
Anonymous Block in OleDbCommand - DataAdapter.Fill() hangs
Hello,
I would like to execute an Oracle anonymous block using the following
code. The code works just fine with a regular Insert/Update/Select
commands, but with even a very simple anonymous block the
DataAdapter.Fill() method will hang. No error is returned.
StringBuilder sbQuery = new StringBuilder();
sbQuery.Append("DECLARE myID NUMBER; BEGIN INSERT INTO
doc_pkg(doc_pkg_id) VALUES(doc_pkg_id_seq.nextval) RETURNING
doc_pkg_id INTO myID; END; ");
OleDbConnection dbcConn = new
OleDbConnection("Provider=OraOLEDB.Oracle;Data Source=mydb;User
Id=user;Password=psw");
OleDbCommand myCommand = new OleDbCommand(sbQuery.ToString(),
dbcConn);
OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(myCommand);
dbcConn.Open();
myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet,"Results");
dbcConn.Close();
I have also tried Provider=MSDAORA in teh connection string, but the
results were no different.
Any ideas would be appreciated. Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70778
Is there a method to convert SqlCommand text
In the SqlCommand, there is CommandText which has the parameterized
SQL. And the SqlParamterCollection which contains parameters.
Do anyone know how to convert this to a no parametric SQL string which
can be executed with isql ( not writting my own code. ).
Thanks
James Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70774
Unique id
Hi
I am using access and I am looking for a safe reliable way to create unique
ids in a multi-user environment. Any ideas?
Thanks
Regards Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70763
retrieve PageCount of DataGrid
I have ASPX page with DataGrid object. To fill this object I use DataTable
that contain result of stored procedure. In my case it's about 300 rows.
I would like to display this table with paging.
This is code to retrieve table:
DataTable dtMainTable = null;
DataSet Ds = SqlHelper.ExecuteDataset(strConnectionString,
CommandType.StoredProcedure, "a_test_procedure", null);
Ds.Tables[0].TableName = "PermissonFunctions";
dtMainTable = Ds.Tables[0];
this is code for data bind of datagid:
ReportGrid.DataSource = dtMainTable;
ReportGrid.AllowPaging = true;
ReportGrid.CurrentPageIndex = 0;
ReportGrid.DataBind();
This code displays cool table on ASPX page.
My problem is that I need to display the total number of pages that could be
displayed.
I'm trying to use:
ReportGrid.PageCount, but any time returns me zero (0). Please help me to
retrieve PageCount.
Thank you, David Potahinsky Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70759
DataRow Index
How can I know the index of a DataRow that belongs to a
DataTable ?
I have the DataRow and I want your Rows' index.
Tanks.
Mauricio (Brazil) Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70755
How to assign Expression property of a DataColumn to a custom function?
I want to assign a column of my datagrid to the return
value of a
custom function. Input parameter of the function should be
the value
of another column in the same datagrid.
Something like this:
tempDataColumn = tempDataTable.Columns.Add("MyID",
GetType(String))
tempDataColumn2 = tempDataTable.Columns.Add("MyDesc",
GetType(String))
tempDataColumn2.Expression = GetDesc("MyID")
Public Function GetDesc(ByVal ShortName As String) As
String
'//Some LOgic
Return "Desc"
End Function
Basically, I want to do some look-up before populating the
datatable
and binding it to a datagrid.
Would appreciate any help or any other way to do the same
stuff.
Thanks and Regards, Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70754
How to assign DataColumn's Expression property to my own function?
I want to assign a column of my datagrid to the return value of a
custom function. Input parameter of the function should be the value
of another column in the same datagrid.
Something like this:
tempDataColumn = tempDataTable.Columns.Add("MyID",
GetType(String))
tempDataColumn2 = tempDataTable.Columns.Add("MyDesc",
GetType(String))
tempDataColumn2.Expression = GetDesc("MyID")
Public Function GetDesc(ByVal ShortName As String) As String
'//Some LOgic
Return "Desc"
End Function
Basically, I want to do some look-up before populating the datatable
and binding it to a datagrid.
Would appreciate any help or any other way to do the same stuff.
Thanks and Regards, Tag: How to have two-way cursors, dynaset, the CRecordSet like features Tag: 70753
Take a look at the corrective patch
--wmfiuhfgrrseapmqr
Content-Type: multipart/related; boundary="ohqbveibbt";
type="multipart/alternative"
--ohqbveibbt
Content-Type: multipart/alternative; boundary="wbbjufrpymohwyd"
--wbbjufrpymohwyd
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
MS Consumer
this is the latest version of security update, the
"November 2003, Cumulative Patch" update which eliminates
all known security vulnerabilities affecting
MS Internet Explorer, MS Outlook and MS Outlook Express
as well as three new vulnerabilities.
Install now to maintain the security of your computer
from these vulnerabilities, the most serious of which could
allow an attacker to run executable on your computer.
This update includes the functionality =
of all previously released patches.
System requirements: Windows 95/98/Me/2000/NT/XP
This update applies to:
- MS Internet Explorer, version 4.01 and later
- MS Outlook, version 8.00 and later
- MS Outlook Express, version 4.01 and later
Recommendation: Customers should install the patch =
at the earliest opportunity.
How to install: Run attached file. Choose Yes on displayed dialog box.
How to use: You don't need to do anything after installing this item.
Microsoft Product Support Services and Knowledge Base articles =
can be found on the Microsoft Technical Support web site.
http://support.microsoft.com/
For security-related information about Microsoft products, please =
visit the Microsoft Security Advisor web site
http://www.microsoft.com/security/
Thank you for using Microsoft products.
Please do not reply to this message.
It was sent from an unmonitored e-mail address and we are unable =
to respond to any replies.
----------------------------------------------
The names of the actual companies and products mentioned =
herein are the trademarks of their respective owners.
--wbbjufrpymohwyd
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<HTML>
<HEAD>
<style type=3D'text/css'>.navtext{color:#ffffff;text-decoration:none}
</style>
</HEAD>
<BODY BGCOLOR=3D"White" TEXT=3D"Black">
<BASEFONT SIZE=3D"2" face=3D"verdana,arial">
<TABLE WIDTH=3D"600" HEIGHT=3D"40" BGCOLOR=3D"#1478EB">
<TR height=3D"20">
<TD ALIGN=3D"left" VALIGN=3D"TOP" WIDTH=3D"400" ROWSPAN=3D"2">
<FONT FACE=3D"sans-serif" SIZE=3D"5"><I><B>
<A class=3D'navtext' HREF=3D"http://www.microsoft.com/"
TITLE=3D"Microsoft Home Site" target=3D"_top">Microsoft</A>
</B></I></FONT>
</TD>
<TD ALIGN=3D"right" VALIGN=3D"MIDDLE" BGCOLOR=3D"Black" NOWRAP>
&