Databinding Question
Hi,
In my app I am trying to bind a dataset to a combo box and I am having some
trouble. In the combo box it shows this "System.Data.DataRowView" for each
record. It is showing the correct number of records. I am calling a stored
procedure in Access with a parameter. It seems to run fine. Any ideas? Tag: Send Connection Instructions to SQL Server Tag: 68211
newbie: forms databinding question
I have a c# windows application binding some controls to a source table: I
can browse the table records by retrieving the CurrencyManager from the
form's BindingContext for my dataset and table and using the Position
property; but I'd like the form to show on demand A SPECIFIC RECORD (if
existing): i.e. I'd like to find a specific record as with the
DataTable.Select method, and set it as the CURRENT record for my form if
found. How can I do this? I don't think I can use Select as it rets a set of
rows but not their index in the table... and I'd need an index to set
CurrencyManager Position.
Thx to all guys! Tag: Send Connection Instructions to SQL Server Tag: 68209
ItemChanged Event in C#
Hi,
I am having problems getting the ItemChanged event to work (it is just not
firing). I followed the steps from KB 312045 INFO: Firing the Windows Forms
CurrencyManager Events in Visual C# .NET, but again, the ItemChanged event
is not firing in that example either.
I can get all the other events related to the currency manager to fire...
I would really like to understand what is going on.
Using Framework 1.1 with a local SQL Server Northwind database (for the KB
article).
Thanks,
James Tag: Send Connection Instructions to SQL Server Tag: 68208
Using XML and ADO.Net for Database creation with the Compact Framework
Hey all
Appologies for cross posting, but this post covers a few areas in one.
I'm fairly new to XML and my ideas are over reaching my grasp (as well
as possibly not fully understanding certain concepts). My basic
questions are:
1.
I want to create a database in SQLCE. I understand that a schema is used
for validation purposes (I think) but if a schema was created describing
a database table, could it be loaded with ADO.net and used to create
the table in SQLCE (all this, of course, occurring on a PDA)? At this
point, there would be no requirement for data.
Or would it be better to use a CREATE TABLE script and simply run it as
a query?
2.
The table would be of a generic design so that, for example, a total of
20 fields would exist but depending on user requirement not all of them
would be used. Would this kind of design then limit the effectiveness
of using XML files for data input/output?
Any input would be apprieciated.
Paul Tag: Send Connection Instructions to SQL Server Tag: 68202
How to use DISTINCT in dataTable.select method
Hi All,
can body give solution to this
________________________________________________
Dim oDataRow As DataRow
oTable = oDataset.Tables(0)
Dim objResults() As DataRow
objResults = oTable.Select("DISTINCT objType")
For Each oDataRow In objResults
debug.writeline(((oDataRow("objType")))
Next
________________________________________________
Thanks
BaluSmiles
Thanks Tag: Send Connection Instructions to SQL Server Tag: 68201
maintaining DB Concurrency in Ado.net
Hi,
How I can prevent concurrent updation of a records in .net.
I am using Dataset which is disconnected from the data source. In this
situation if
two users opens the same record, modifies the data and updates one after
another,
my data won't be in the correct state. How I can prevent this. Is there any
locking technics.
Need Advice
Babz Tag: Send Connection Instructions to SQL Server Tag: 68197
DataTable.RowChanged - Newest row doesn't exist
Hi
If I add a eventhandle to DataTable.RowChanged, I get a event when a new row
is added. But the row isn't in DataTable.Rows??? Tag: Send Connection Instructions to SQL Server Tag: 68193
Dataset Properties Descrepencies From Table Design
VS 2003 VB net sql msde...
I used Server Explorer, Design Table, to define two tables primary keys
identically (i.e. autoincrement, same seed & increment, both clustered,
etc.)
In Component designer, I create a DataAdapter for each table above and then
generate the dataset adding the tables above to the dataset. However, when
I look at dataset properties (right click on DataSet), one of the two
primary keys is how I defined it in Design Table above, but the other one is
not.
This problem exists with many other tables, and I can see no pattern or
reason.
Is Dataset Properties reporting the wrong information? What is the problem
here? I would think this info would be pulled directly from the Design
Table information.
Please advise
Bob Day Tag: Send Connection Instructions to SQL Server Tag: 68180
DataSource Indexes Vs. DataAdapter Select Statements
Using vs 2003, vb.net, sql msde
Using Server Explorer, Design Table design a table with only a Primary
Index.
Example with 4 columns (but no index created for them, except primary key).
Table PINS
Primary Key, autoincrement
IX_PINS, string
IX_Role_Number, String
IX_Outbound_Calling_Status, string
Using Component Designer, I will Create a DataAdatapter with a 'covering'
select statement. I can selectively drop % into the statement below to
'ignore' any one of the three @variables.
Example of where section:
WHERE (PINS.fld_IX_PIN LIKE @PIN) AND (PINS.fld_IX_Role_Number LIKE
@ROLE_NUMBER) AND (PINS.fid_IX_Outbound_Calling_Status_Number LIKE
@OUTBOUND_CALLING_STATUS_NUMBER)
Here is my question. The above works fine with no indexes defined in Design
Table (i.e. the underlying datasource), but I suspect I am taking a
performance hit. When I design the table, how should the indexes be
designed to maximize the performance of the DataAdapter?
Scenario one: Design 3 different indexes, each one being on one indexed
column. This is easy to do, but I am not sure it helps the DataAdapter if
it uses multiple columns. But it seems the only possible option, because it
would allow me to define PIN as Unique Index, while the other two as not
unique.
Scenario two: Design 1 index with all index columns, starting with the
narrower columns first. This would amount to a 'covering' index (i.e
something like Outbound_Calling_StatusNumber+Role_Number+PIN). Logically,
this would be best for the DataAdapter (both covering), but doesn't seem
possible since I could not define PIN alone as a Unique index with the other
two not being unique.
Scenario three: Design as many indexes as possible, one each to match a
possible combinations of the 'covering' data adapter. Each index would have
multiple columns. For example, one index might be PIN, another PIN + Role,
another PIN+Role+Outbound Calling Status Number. This doesn't seem
practical since it would require predicting all possible combinations of the
use of the DataAdapater in advance.
Please advise.
Bob Day Tag: Send Connection Instructions to SQL Server Tag: 68178
Sceppa Core Reference errata on pp 469/473 and please help with concurrency error
I'm having trouble with concurrency errors (0 records affected)
but the Core Reference section relating to this subject seems to
have an error in the code sample. Maybe I'm wrong about this;
could someone please correct me if so!
On p. 473, the timestamp column is being assigned a value
e.Row("TSCol") = ....
and the penultimate paragraph on the page reads:
"After retrieving the new timestamp value and assigning it to the
appropriate column in the DataRow object..."
** But when I try to assign this column, I get an error that my
(SQLServer2000) timestamp column is READONLY. **
My update command uses the Primary Key and the timestamp columns
to check for concurrent changes to the row. My update command goes
like this:
Update T
Set ...
where PK = @PK and TS = @TS
And in the OnRowUpdated eventhandler, I assign the UpdateCommand
timestamp parameter as follows:
UpdateCommand.Parameters("@TS").Value = cmdGetTS.ExecuteScalar
However, when I make a second change to a record that I have just
updated (the scenario described at top of p.469 in Core
Reference), I get a concurrency error (0 records affected) even
though I am indeed using the most recent timestamp and have
correctly assigned the TS and PK parameters of my update query
prior to invoking the DA.Update() method.
Page 469 reads: "If you don't have the new value for the timestamp
column in your DataRow object, the subsequent update attempt will
fail."
I don't understand why the *row* must contain the new timestamp
value if one is using the primary key and the timestamp to test
for concurrency problems, and the update command takes the form
"Update Table ...where PK=@PK and TS=@TS". Wouldn't you want to
assign the UpdateCommand.Parameters("@TS") instead of the
e.row("TS")?
Clarification appreciated!
Timo Tag: Send Connection Instructions to SQL Server Tag: 68177
newbie needs a sample
I am a programmer that is fluent in Visual Basic 6.0, and I am trying to
learn VB .NET. I would like to create an application that imports comma
separated data in a textfile into a database in Access or SQL Server. I am
familiar with ADO, but not with ADO .NET. Would someone be kind enough to
send me a sample project to get me started?
Daniel Tag: Send Connection Instructions to SQL Server Tag: 68169
Transfering a dataset
I am reading a dataset from a CSV file and creating XML. From there I put it
into a dataset.
What I want to do now is to take that datatable and store it into a database
(through an ODBC connection).
I thought there was an easy way to assign the dataset to the new connection
and/or dataadapter and tell it to store/save/etc. the datatable to the
database.
Can someone point me in the right direction? Or am I just off my rocker
again?
Thank you for any insight you can provide,
Ken Tag: Send Connection Instructions to SQL Server Tag: 68168
Quick Question
Hi,
I am wondering what is faster. I am useing OLEDB to connect to an Access
database and was wondering which is faster. Calling a query saved in Access
or using SQL in the program? And is it a big difference in performance.
Thanks in Advance Tag: Send Connection Instructions to SQL Server Tag: 68154
Creating logins
Can I create a Windows Group login from .Net code, and if so, how?!
Cheers in advance
Sparky Tag: Send Connection Instructions to SQL Server Tag: 68144
Quey builder
Hi,
I like to create a query builder to allow the user to create his statistics
and see them using Cristal report
Any idea about how to do this, is there any controls that can help me.
Thanks. Tag: Send Connection Instructions to SQL Server Tag: 68141
Datagrid getting info from two tables in one database
Hi,
I'm quite new to developing ASP.NET applications with databases (ADO).
I think I've got a very easy question, but I haven't been able to sort
it out yet.
In SQL Server I've got two tables in my database: "issues" and
"users". The idea of the application (I use C#) is that users can add
issues. So the "issues" table has a secondairy key "user_id" connected
to the "id" column of the "user" table.
In a datagrid I want to show the "issue" table, but (!) instead of
showing the user_id number on this grid (from the "issue" table), I'd
like to show the matching name taken from the "users" table". Second,
when this datagrid is edited the user column should show a dropdown
list with all the user names, instead of the standard textfiels with
the "user_id". I've found something for this using the ASPX code;
<<<CODE>>>
<EditItemTemplate>
<asp:DropDownList id="Dropdownlist1" runat="server" DataSource="<%#
dataSet1 %>" DataMember="Users" DataTextField="name"
DataValueField="id">
</asp:DropDownList>
</EditItemTemplate>
<<<END CODE>>>
This option does show a dropdown list with all usernames in my
datagrid when I go to the editmode of this datagrid. However the
top-item of this dropdownlist is always selected by default. I want
the application to check which value the "user_id" fiels in the
"issues" table has and find the matching name in the "users" table and
fills this in. And in non-edit mode I want the datagrid to also so the
user name matching the user_id.
Any help would very much be appreciated.
Regards,
Jules Hoppenbrouwers
<Please reply to this newsgroup. The emailaddress is just a
spamcatcher.> Tag: Send Connection Instructions to SQL Server Tag: 68138
Juction tables
Using VS 2003, VB.net, SQL MSDE
Doing my first junction table in Server Explorer, Database diagrams, and
having the following error message below on one of the relations. I am
following the instructions exactly, so I am not sure what the problem is.
3 tables in a telephony application:
Table 1 is Calls (i.e. telephone calls)
Table 2 is Calls_Customer_Junction (consists of only primary keys from table
1 and 2, which are both primary keys in table 2)
Table 3 is Customers (i.e. Customer who answered the call)
The relationship between table 1 and 3 is many to many (I think), each Calls
row could have a different Customers row and each Customers row could be
from a different Calls row.
The one to many relation from Table 1 to Table 2 draws fine and saves fine.
But, the one to many relation from Table 3 to Table 2 draws fine, but when
you save it, you get the error message below.
Not sure what the problem is. Any ideas? Any links that might help?
Thanks.
Bob
'Customers' table saved successfully
'Calls_Customers_Junction' table
- Unable to create relationship 'FK_Calls_Customers_Junction_Customers'.
ADO error: Introducing FOREIGN KEY constraint
'FK_Calls_Customers_Junction_Customers' on table 'Calls_Customers_Junction'
may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or
ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Could not create constraint. See previous errors. Tag: Send Connection Instructions to SQL Server Tag: 68135
How to derive SqlDbType from column data type
I need to know the correct SqlDbType of a column to use it in a dinamically
build parametrized sqlCommand.
As I can see when I build a parameter it expects a System.Data.SqlDbType but
if I look at the DataType property of a column in a table in a dataset I get
a diferent 'type' of data.
Is there a way to derive the SqlDbType from the dataset.datatable.column
datatype?
Vicenc Tag: Send Connection Instructions to SQL Server Tag: 68123
oledbDataAdpater Memory Leak
I have written a Windows Service using VB.NET that reads the mySQL
database and creates an XML for the data. This process is called
inside a timer's (to generate the XML files at specified time
interval) Tick event. I use oledb for connecting to the database.
Now the [Memory usage] for my service in the [Windows Task Manager]
rises each time the timer event is fired and never drops back.
Now after some period of time the system crashes due to memory leak.
When I comment the Fill method code and run the service, the memory
usage is stable.
How can this (type of memory leak) be prevented. Is this due to the
Memory leak problem of oleDBDataAdapter's Fill method.
Why the objects are not Garbage collected after the objects are closed
in