timestamp
hi there
in my database i have a column timestamp (sql server 2000) . now i read this
entry with a reader:
programming language: c#.net
...
...
byte test ;
while (reader.Read())
{
test = Convert.ToByte(reader["AdrTimestamp"]);
}
...
...
i got the answer that this cast is not valid
i also tried to do id with a string
stringTest = Convert.ToByte(reader["AdrTimestamp"]);
or i tried:
stringTest = reader["AdrTimestamp"].ToString();
but the Value i then get is: "System.Byte[]" but i would like to see its
value....
could anyone help please ? this would be great...
thanks
jonas Tag: MIcrosoft ODP Tag: 67274
Expression DataColumns don't get evaluated after a DataSet Merge()
Hi,
After creating a DataSet with an Expression Column y I'm trying to Merge
some data from another DataSet returned by the middle tier. Both source and
destination DataSet have the same columns and tables, except for one
expression column wich can be easily evaluated as result of two other
columns (say FullName = LastName + ', ' + FirstName).
For some reason, after I merge the DataSet, if I look to the value of the
expression-column for the merged rows, they all have DbNull value instead of
the value returned by the expression. But if I add a new DataRow trough code
the expression gets properly evaluated just in that row.
Is there a reason for this behavior? Is this a bug? Is this by design?
My workaround is to reset the expression after I merge the two DataSet.
After that, all the rows have the correct value in the expression column:
DataSet ds = MiddleTier.GetData();
myDataSet.Merge(ds);
//workaround: after Merge, reset expression to the same expression
myDataSet.Tables[0].Columns["FullName"].Expression += "";
This is very ugly code. Is there a better, scientific, Microsoft approved
way to tell a DataColumn to reevaluate an expression after a
DataSet.Merge(). Why expression-based columns don't get reevaluated after a
DataSet.Merge(). Thanks.
Germán. Spain. Tag: MIcrosoft ODP Tag: 67270
ODBC Database Connection Woes in ASP .NET
This problem has had me stuck for weeks now...
I have an ASP .NET application on a machine running Windows 2000
Server.
It connects to an ODBC data source using the ODBC Data Provider.
The connection takes about 5 seconds to create.
It takes 5 seconds whether I load the application locally on the
server's browser, or across the network from a client PC.
A Windows Forms application on the same server, creates the same
connection in 0.7 seconds.
The same ASP .NET application installed on a low spec development
machine running Windows 2000 Professional (or Windows XP Pro), opens
the connection in 0.7 seconds.
Please, please tell me if you have seen this before and give me some
ideas.
I've tried everything!
Thanks In Advance
James Tag: MIcrosoft ODP Tag: 67269
Exception: 'ResourcePool' is not supported on the current platform.
I recieve this error in ASP .NET project while I try to connect SQL Server
Exception:
PlatformNotSupportedException: 'ResourcePool' is not supported on the
current platform.
What can be cause of this error?
Environment:
Windows 2000 Advanced Server
.NET Framework 1.0.3705.0 Tag: MIcrosoft ODP Tag: 67268
Access data in a commasep. text file
I need to write a program that accesses data in=20
commaseparated text file. Instead of just reading the=20
lines and chopping out the text in field values, I=20
thought that I could use ODBC to just access it as a=20
table.
I have created a File-DSN for the directory where the=20
file is located. A specific file cannot be referenced in=20
the DSN entry. I guess that the individual files are=20
considered tables for such an entry.=20
I have then selected an ODBC connection (ODBC connection=20
1)from the dataobjects tab and have set its=20
ConnectionString property to the DSN entry:=20
"SafeTransactions=3D0;MaxScanRows=3D8;DefaultDir=3DF:\Visual=20
Studio Projects\N=F8gleta" & _
"l - Dataopdatering\Test Data;FILEDSN=3DF:\Visual=20
Studio Projects\N=F8gletal -" & _
" Dataopdatering\Statoil Data\Test=20
Data.dsn;DriverId=3D27;UID=3Dadmin;UserCommitSy" & _
"nc=3DYes;FIL=3Dtext;PageTimeout=3D5;Driver=3D{Microsoft=20
Text Driver (*.txt; *.csv)};MaxB" & _
"ufferSize=3D2048;Threads=3D3"
(this was generated by the VB when i chose new connection=20
and pointed to the File-DSN)
However, I don't seem to be able to get the Dataadapter=20
working:
Dim dadapKunde1 As Odbc.OdbcDataAdapter
Dim str_sql As String =3D "SELECT * FROM Kunddat1.txt"
dadapKunde1 =3D New Odbc.OdbcDataAdapter(str_sql,=20
OdbcConnection1)
dadapKunde1.Fill(datsetKunde1, "Kunddat1.txt")
When I run the code there is an error in the last=20
statement:
"An unhandled exception of=20
type 'System.ArgumentNullException' occurred in=20
system.data.dll
Additional information: A Value may not be null"
Perhaps i am handling the reference to the file=20
(Kunddat1.txt) wrongly. I just don't see where to=20
reference it otherwise. The DSN entry only points to the=20
directory. But it should be possible.
Any help is appreciated.
With kind regards,
Frank Tag: MIcrosoft ODP Tag: 67267
datagrids and the edititemindex
Hi,
I've bound a datareader to a datagrid.
I can change each row with the onEdit, onCancel and
onUpdate events of the datagrid.
But is there a way that I can change all th erows of the
datagrid at a time, so I don't have to edit each row
sepperatly.
Thanks for the answer
filip Tag: MIcrosoft ODP Tag: 67265
DataColumn.Expression Property
Hello,
I want to use the expression property to add a column to
my dataset, of the type xs:duration(System.TimeSpan). via
the expresion, I want to caluculate the difference between
to xs:time(System.DateTime) columns. But when I
enter "col2 - col1" in the expresion, I get a runtime
error that tells me that "-" is not supported on
System.DateTime.
Anybody has an idea how I can get the result I want?
thanks,
Gert
P.S., My dataset is a typed dataset created via the xsd
designer of Visual Studio. I do not connect to a database,
I use the dataset as a local database. Tag: MIcrosoft ODP Tag: 67264
binding data to datagrid
Hi all,
Struggling with something at the moment. I've got a
Employee database that I want users to search through the
intranet, via an asp.net web form. I've got it working
using a dataset bound to a Data Grid and it works well so
far. Now, when searching for someone, say, Joe Smith, I
only want one record for him to come up. For example,
something like:
Joe Smith
Job Title: IT Manager, Location: Chelmsford
Work Tel: 27394739 , E-mail: someone@anywhere.com
However, because of the nature of our business, there are
some employees who have more than one job title, or
because they are mobile, they are based at several
locations. The problem is, for every additional Job
Title, or Location, it displays a new record for Joe
Smith. It's not a duplicate, because the job title or
location is different, but it doesn't look good having
several records for the same person with just a few
differences that people will have to make out.
Just so you have an idea- let's say there are tables in
the database: Employee, JobTitles, Locations, and two
cross-reference tables: EmployeeJobTitle and
EmployeeLocation.
I'm a beginner in both SQL and VB.Net so don't really
know whether this would be implemented on the database or
programming side, but I assume it will be more on the SQL
side.
Any help much appreciated- and if you would like to see
more (existing scripts, queries etc) just let me know.
Jano Tag: MIcrosoft ODP Tag: 67263
Search by column
Visual Basic.NET, SQL db
--------------------------------------
objRow = objDataSet.Tables("Owners").Rows.Find
(txtSearch.Text)
Here I'm using Find to search SQL database by primary key.
How do I search this database by row but without primary
key.
I would like to search by column "Name" Tag: MIcrosoft ODP Tag: 67261
How to retrieve provider-side parameter information for the stored procedure in ADO.NET
hello~
In ADO 2.7, there is a Refresh method can get the parameter infomation
of a store procedure
like this...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdamth03_7.asp
But, I can not find the same method in ADO.NET.
How can I do the same thing in ADO.NET? Tag: MIcrosoft ODP Tag: 67260
Connecting to IBM db2
I want to know what port ado.net uses to connect to an IBM
db2 database located remotely. As i want to open the
specific protocol based port on the database server. Tag: MIcrosoft ODP Tag: 67259
Restore Database from network drive doesnt work
Hi,
I'm using the following c# code to restore a database:
SqlCommand sqlCommand2 = new SqlCommand(@"RESTORE DATABASE datalo FROM
DISK='"+fileNavn+@".dat.dtldb' WITH MOVE 'datalo' TO
'C:\programmer\datalo\data\datalo.mdf', MOVE 'datalo_log' TO
'C:\programmer\datalo\data\datalo.ldf'", sqlConnection);
sqlCommand2.Connection.Open();
sqlCommand2.CommandTimeout = 300;
sqlCommand2.ExecuteNonQuery();
sqlCommand2.Connection.Close();
The code works perfectly if the backup-file "fileNavn" is located on a lokal
drive, but if it's on a network drive, I get exception:
System.Data.SqlClient.SqlException: Cannot open backup device
'\\filserver\test.dat.dtldb'. Device error or device off-line. See the SQL
Server error log for more details.
RESTORE DATABASE is terminating abnormally.
(The exact same commandtext works from osql.exe)
Any ideas? Tag: MIcrosoft ODP Tag: 67257
Custom data columns
Can you reference a custom datatype in the xsd for a table column?
I can make a table with a custom datatype for one of the columns and write
out the xsd, but when I try to use the xsd to make a TypedDataset, I get a
message " Column requires a valid DataType"
Some putz decided that they were going to change the date datatypes in SQL
to a string rep CCYYMMDD instead to make ... easier. Now I want to make a
class which can act like a stirng to the dataset and sql, but would mark the
column as one which should be treated as a date for comparison... (This is
also the case for some longs, decimal and int columns).
This is the schema created: Is there something missing? Is there a better
way to do this?
<?xml version="1.0" standalone="yes"?>
<xs:schema id="testds" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="testds" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="testtbl">
<xs:complexType>
<xs:sequence>
<xs:element name="id" type="xs:long" minOccurs="0" />
<xs:element name="tst" msdata:DataType="myDomain.stringtest,
TestsAsm, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema> Tag: MIcrosoft ODP Tag: 67247
DataAdapter.Fill & AutoIncrement -> ConstraintException
DataLayer's steps:
1. DataAdapter.Update(dtUserChanges)
2. DataAdapter.Fill(dtUserChanges)
I'm having trouble with DataAdapter.Fill creating
duplicate rows in a table which has an AutoIncrement
primary key. When it happens, I get a
ConstraintException thrown from the Fill method. I know
it's happening because, to keep the DataSet mergeable, I
handle DataAdapter.RowUpdating and set
sqlRowUpdatedEventArgs.Status =
UpdateStatus.SkipCurrentRow. What's a good way to deal
with this problem? Tag: MIcrosoft ODP Tag: 67246
prevent duplicates in a data column
Hi
Iam retreiving a Dataset from a webservice into my web application. I have
to populate a dropdown web control with it but my problem is that the column
of countries that i want to populate the dropdown list has duplicate values
..... how can i prevent that from appearing in a dropdownlist bounded to the
dataset without making changes in the sql data retrival select statement in
my webservice code......
thanks
Afsheen Tag: MIcrosoft ODP Tag: 67241
Last Rows Retreived by a DataAdapter
Is there a way to get just the last DataRows retreived by a data adapter?
Thanks,
John Tag: MIcrosoft ODP Tag: 67240
{{{EASY MONEY}}}
Dear Internet User:
Good Day! This article I've written is all about the fact where I earned an
ASTOUNDING amount of money in less than a month and I've decided to share
the secret with you.(yah you the one reading this message) behind making big
bucks in the Mail Order Business.
So all money seekers. Read this carefully!
I found this on a bulletin board like this one and decided to try it because
I was desperate for money. A little while back I was browsing through
several newsgroups, just like you are now, and came across an article,
similar to this, that said you could make thousands of dollars within weeks,
with only an additional investment of $6.00! So I thought, "Yah right! This
must be a scam," but like most of us, I was curious so I kept reading.
Anyway, it said that: you need to send $1.00 to each of the six names and
address stated in this article. You then place your own name and address in
the bottom of the list at #6, and post the article in at least 200
newsgroups. (There are millions) No catch, that was it. So after thinking it
over and talking to a few people first, I thought about trying it! I
figured: "What have I got to loose except 6 stamps, and $6.00, right?" Then
I invested the measly $6.00. WELL, GUESS WHAT!!. Within 7 days, I started
getting money in them mail! I was SHOCKED!!! I figured it would end soon,
but the money just kept on coming in. In my first week, I made about $25.00.
By the end of the second week I had made a total of over $1,000.00! In the
third week I had over $10,000.00 and it's still growing! This is now my
fourth week and I have made just over 42,000.00, and it's still coming in
very rapidly! It's certainly worth $6.00, and 6 stamps, I have spend more
than that in the lottery!!!
Let me tell you how this works, and most importantly, why it works.. Also,
make sure you print a copy of this article NOW, so you can get the
information off of it as you need it. I promise you that if you follow the
directions exactly, that you will start making more money than you thought
possible by doing something so easy!
SUGGESTION: READ THIS ENTIRE MESSAGE CAREFULLY! (print it out or download
it.) Follow the simple directions and watch the money come in! It's easy. It
's legal. And, your investment is only $6.00 (plus postage).
IMPORTANT: This is not a rip-off; it is not indecent; it is not illegal; and
it is virtually no risk-it really works!!!! If all the following
instructions are adhered to, you will receive extraordinary dividends!
PLEASE NOTE: Please follow these directions EXACTLY, and $50,000.00 or more
can be yours in 20-60 days. This program remains successful because of the
honesty and integrity of the participants. Please continue its success by
carefully adhering to the instructions. You will now become part of the Mail
Order business. In this business your product your product is not sold and
tangible, it's a service. You are in the business of developing Mailing
Lists. Many large corporations are happy to pay big bucks for quality lists.
However the money made from the mailing lists is secondary to the income
which is made from people like you and me asking to be included in that.
~~~~> HERE ARE 4 EASY STEPS TO GET STARTED <~~~~
STEP 1: Get six separate pieces of paper and write the following on each
piece of paper, "PLEASE PUT ME ON YOUR MAILING LIST." Now get 6 US $1.00
bills and place ONE inside EACH of the 6 pieces of paper so the bill will
not be seen through the envelope (Please make sure that the bill wouldn't be
noticed in the envelope to prevent thievery ) Send out US $ DOLLAR, so it
would be more acceptable.
STEP 2: Next, place one paper (with the bill inside) in each of the six
envelopes and seal them properly. You should now have six sealed envelopes,
each with a piece of paper stating the phrase: "PLEASE PUT ME ON YOUR
MAILING LIST," your name and address, and a $1.00 bill.
Note: You might want to rent a post office box, at the local post office,
and use a fictitious name, as this will keep unnecessary harrassments away
from you...
What you are doing is creating a service. THIS IS ABSOLUTELY LEGAL!!! You
are requesting for a legitimate service and you are paying for it! Like most
of us, I was a little skeptical and a little worried about the legal aspects
of it all. So I checked it out with the U.S. Post office (1-800-725-2161)
and they confirmed that it is indeed legal!
MAIL THE 6 ENVELOPES TO THE FOLLOWING ADDRESSES BELOW:
#1.) Victor Bell
5820 N Kenmore
Chicago, IL 60660
Apt. 201
#2.) A.N. Flegel
18501 68th ST. E
Bonney Lake, WA 98390
#3.) Jimmy Opruta
914 N Louise
Glendale, CA 91207
Apt. 2
#4.) Chris Witcher
PMB #219
1955 Monument Blvd. 4B
Concord, CA 94520
#5.) Roy's Corp
PO Box 622283
Orlando, Florida
32862
#6.) R Davis
PO Box 620241
Oviedo, Fl.
32762
STEP 3: Now take the #1 name off the list that you see above, move the other
names up (6 becomes 5, 5 becomes 4, ect.) and add YOUR Name as number 6 on
the list.
STEP 4: copy this article. Change anything you need to, but try to keep this
article as close to the original as possible. Now, post your amended article
to at least 200 newsgroups. (I think there are close to 2.4 million groups)
All you need is 200, but remember, the more you post, the more money you
make!!! (You can make thousands of dollars more if you add just 20 more
newsgroups to the 200) This is perfectly legal! If you have any doubts,
refer to Title 18, Section 1302 and 1341, US Postal and Lottery Laws or
Title 18, Section 3005 in the US code, also in the code of Federal
regulations, volume 16, sections 255 and 436, which states; "a product or
service must be exchanged for money received." The simple note in the
letter, "PLEASE PUT ME ON YOUR MAILING LIST," Makes it legal because you are
paying for exchange of a service, (adding the purchasers name to his mailing
list) for a $1.00 fee.
KEEP A COPY OF THESE STEPS FOR YOURSELF, and whenever you need the money,
you can use it again and again! PLEASE REMEMBER that this program remains
successful because of the honesty and integrity of the participants and by
their carefully adhering to the directions. Look at it this way: If you are
of integrity, the program will continue, and the money that so many others
have received will come your way.
NOTE: You may want to retain every name and address sent to you, either on a
computer or hard copy, and keep the notes people send you. This VERIFIES
that you are truly providing a service. (Also it might be a good idea to
wrap the $1.00 bill in dark paper to reduce the risk of mail theft.) So, as
each post is downloaded and the directions carefully followed, six members
will be reimbursed for their participation as a List Developer with one
dollar each. Your name will move up the list geometrically so that when your
name reaches the #1 position you will be receiving thousands of dollars in
CASH!!! What an opportunity for only $6.00 ($1.00 for each of the first six
people listed above) Send it now, add your name to the list and you're in
business!
~~~~> DIRECTIONS FOR HOW TO POST TO NEWSGROUPS<~~~~
STEP 1: You do not need to re-type this entire letter to do your own
posting. Simply put your mouse curser at the beginning of this letter, click
and drag your curser to the bottom of this document, right click and select
'copy' from the edit menu. This will copy the entire letter into the
computers memory.
STEP 2: Open a blank 'notepad' file and place your mouse curser at the top
of the black page. Right click and click the 'edit' menu, select 'paste.'
This will paste a copy of the letter into notepad so that you can add your
name and postal address to the list.
STEP 3: Save your new notepad file as a .txt file. If you want to do your
postings in different settings, you'll always have this file to go back to.
STEP 4: Use Netscape or Internet Explorer and post this article as a new
message by highlighting the text of this letter and selecting paste from the
edit menu. Fill in the subject, this will be the header that everyone sees
as they scroll through the list of postings in a particular group, click the
"post" message button. You're done with your first one! NOTE: Please don't
SPAM or send unsolicited emails. It's completely illegal. Send emails to all
the people you know or any ways that allow you to, instead of SPAMMING.
(Just a reminder)
CONGRATULATIONS.. THAT'S IT!!! All you have to do is just to different
newsgroups and post away, after you get the hang of it, it will take about a
minute for each newsgroup! ** REMEMBER, THE MORE NEWSGROUPS YOU POST IN, THE
MORE MONEY YOU WILL MAKE!! BUT YOU HAVE TO POST A MINIMUN OF 200** That's
it! You will begin receiving money from around the world within days!!! NO
JOKE!!! You may eventually rent a P.O. Box due to large amounts of mail you
will receive. If you wish to stay anonymous, you can invent a name to use,
as long as the postman will deliver it. ** JUST MAKE SURE ALL THE ADDRESSES
ARE CORRECT. **
* Now the WHY part; Out of 200 postings, say I receive only 5 replies (a
very low example). So then I made $5.00 with my name at #6 on the letter.
Now each of the 5 persons who just sent me $1.00 make the MINIMUN 200
postings, each with my name at #5 and only 5 persons respond to each of the
original five, this is another $25.00 for me, now those 25 each make 200
MINIMUM posts with my name at #4 and only 5 replies each, I will bring in an
additional $125.00! Now those, 125 persons turn around and post the MINIMUM
200 with my name at #3 and only receive 5 replies each, I will make an
additional $626.00! OK, now here is the fun part, each of those 625 persons
post a MINIMUM 200 letters with my name at #2, and they each only receive 5
replies, that just made me $3125.00!!! Those 3,125 persons will all deliver
this message to 200 newsgroups with my name at #1 and if STILL only 5
persons per 200 newsgroups react I will receive $15,625.00! With an original
investment of only $6.00! AMAZING!!! When your name is no longer on the
list, putting your name at number 6 again. And start posting again. The
thing to remember is: do you realize that thousands of people all over the
world are joining the Internet and reading these articles everyday? JUST
LIKE YOU are now!! So, can you afford $6.00 and see if it really works?? I
think so. People have said, "what if the plan is played out and no one
sends you the money." So what! What are the chances of that happening when
there are tons of new honest users and new honest people who are joining the
Internet and newsgroups everyday and are willing to give it a try? Estimates
are at 20,000 to 50,000 new users everyday, with thousands of those joining
the actual Internet!!! REMEMBER, PLAY FAIRLY AND HONESTLY AND THIS WILL WORK
FOR YOU!!!
Report Corporate Fraud!
Call 888.622.0117 to report corporate fraud to the FBI. Tag: MIcrosoft ODP Tag: 67238
Default dates
There are various dates that are used as DEFAULT dates in the different
databases...... Is there a single method that will identify if the date
that comes back from a database is the DEFAULT date vs one that has been
entered ?
Example: DB2 uses 01/01/0001 as their default date.... FoxPro allowed a
blank date... which when retrieved by .NET comes back as 12/30/1899.....
Is there a method that we can use to determine if this is the default...
or a entered date ? Tag: MIcrosoft ODP Tag: 67237
Strange error with ODBCDataAdapter.SelectCommand
Hi,
I am attempting to create a vb.net frontend for a mysql database via
ODBC.
My problem (so far) is that I cannot get my
ODBCdatadapter.SelectCommand properities to "stay". First of all I
cannot input them at all through the DataAdapter properties window;
the SelectCommand, InsertCommand and DeleteCommand properties are all
greyed out for some reason. Okay, fine, I can code them manually:
MyODBCAdapter.SelectCommand = New ODBCCommand("Select * from
master_planner",conn)
This works, and the result are then even visible and accessible in
the properties window after I do. BUT THEY DISAPPEAR WHEN I TRY TO
BUILD!! The code I put in just vanishes! This has happened several
times; I cannot find a workaround.
As I am using the 2002 version of vb.net, I cannot use the wizard to
configure the ODBCdataadapter. Has anyone every seen this before?
Thank you,
Mike Cooper Tag: MIcrosoft ODP Tag: 67232
Adding new rows in child with ReadOnly parent
I need a little push on how to add new rows to a child.
The parent does not change and would be read only. Using
the Northwind database, they can add new products but can
not add new categories. I am using a Datarelation
between the two tables and using textboxes to display the
child information.
I have the databinding for the textbox going. However, I
am not sure about how to get started with getting the new
row inserted in to the database.
Any little push to get me started in the right direction
would be helpful.
Thanks,
Charles Tag: MIcrosoft ODP Tag: 67228
UniqueConstraint
Hi all,
I trying to make the code below work without success
Sub x()
Dim t As DataTable = New DataTable("t")
Dim c1 As DataColumn = New DataColumn("col1", GetType(String))
Dim c2 As DataColumn = New DataColumn("col2", GetType(String))
Dim c3 As DataColumn = New DataColumn("col3", GetType(String))
t.Columns.Add(c1)
t.Columns.Add(c2)
t.Columns.Add(c3)
Dim u As UniqueConstraint = New UniqueConstraint("u", New String()
{c1.ColumnName, c2.ColumnName}, True)
t.Constraints.Add(u)
End Sub
The problem is that if you inspect "u", it's properties aren't setted.
This is an overloaded constructor as documented in
help://MS.VSCC.2003/MS.MSDNQTR.2003APR.1033/cpref/html/frlrfsystemdataunique
constraintclassctortopic9.htm
I need this overload since it seems to be the only way I can create a
multi-column primary key in a DataTable on the Compact Framework, but it
can't get it to work either on the .NET Framework 1.1
Am I missing something?
Thanks in advance for any help provided.
Alfred Gary Myers Jr.. Tag: MIcrosoft ODP Tag: 67222
setting null values to parameters
Hello,
I use web-service, and also access for my database, and VB as my script of
web-service, and oleDBConnection to connect to database.
I have created a oleDbParameter.
I want to set it null value -
How can I do that ?
Thanks :) Tag: MIcrosoft ODP Tag: 67221
DataGrid and sorting
I have a DataGrid that I am using as the master in a
master-detail relationship. When the user double clicks
on a row of the DataGrid, I update the details section
(some TextBoxes, etc.) by using CurrencyManager.Position
= N, where N is the row index in the DataGrid that the
user just double clicked on.
This all works great until the DataGrid is sorted. At
this point, the row index in the DataGrid no longer
corresponds to the row's position in the underlying
dataset. What is the easiest way to get the correct index
to use when setting the position of the CurrencyManager?
Thanks,
Mike Tag: MIcrosoft ODP Tag: 67220
Connection Pooling is not working
Hi,
I have Windows Form application that access Sql Server 2000.
I copied this application inside a network path (Ex: h:\application).
The connection string is inside the application (hard-coded). If five
users access the application and I run sp_who in Query Analyzer it
displays five connections. The question is: Do I need to build an Enterprise
Serviced component and set the object pooling property as true to make
it work?
I say that because when I have one thread and I create two or more
connections inside this thread I know that the connection pooling will
work.
Regards,
Marco Tag: MIcrosoft ODP Tag: 67215
Conditionally adding/removing items to a DataGrid
Hi,
I'm working on an ASPX page which has a DataGrid. This DataGrid is bound
to a custom object. My requirement is that at rune time, I want the datagrid
to display the items that match a certain criteria.
For example, I have a custom collection named Users to which the DataGrid is
bound. The Users collection represents the entire list of users for my
system. But when displaying the datagrid, I want to display only those users
that have the "administrator" role. Is there any way in which I can do this
throuh the ItemDataBound event?
CGuy Tag: MIcrosoft ODP Tag: 67211
How to work with joined tables in ADO.NET
Hi.
I have (simplified) 3 tables. (See bottom). This is not my real tables but
they show my point. I want to represent data from all tree tables and i
wanna do this by joining them. The joined data will be represented in a
datagrid, where editing,inserting, deleting will be aviable.Update is ok for
now.
How do i do this the right ADO.net way? I just cant figure out an elegant
way to perform the update. Eg. i can make a view wich fetch the data, and
put it in the grid....But how do i update the right tables on an elegant
way? Eg. I edit a country tag, and want to peform an update.
Ideally i have my database, a webservive from where i get a dataset, and
where i (maybe sent som kind of a diffgram) wich enable the webservice to
perform the updates. All this i can figure out if it wasnt for the joins.
Anyone know how to work with joined tables in ADO.net or have some links? I
have used HOURS to read "all" the MSDN articles about datasets, dataadpters,
autogen commands, but nothing seems to solve my problem ....an "easy" way.
It cant be right that i have to wirte a stored-proc where i sent (see
bottom) all me variables and make it update each and every table manually?
Looking forward to some inputs.
Regards Anders
======Tables========
TablePerson
-------------
Id
Country_FKId
City_FKId
TableCountry
--------------
Id
Country
TableCity
--------------
Id
City
================= Tag: MIcrosoft ODP Tag: 67206
Not associated with a trusted SQL Server connection
I am new to ASP & ADO.NET and IIS web applications, but
not to SQL databases. I can successfully build Windows-
forms apps using Visual Studio ADO. However, I can't
connect for Web forms. I created a sqlconnection and
sqladapter to my SQL Server,Northwind db, which I dragged
from Server Explorer. I generate a dataset, and Preview
Data in the da, works fine. I then enter vb code on
Page_Load event:
SqlDataAdapter1.Fill(ds)
DataGrid1.DataSource = ds.Tables("Employees")
DataGrid1.DataBind()
When I build and browse (localhost), I get:
Server Error in 'myapp'...SqlException: Login failed for
user (null). Reason: Not associated with a trusted SQL
Server connection. I have since found error codes
SQLState 42000 and SQL Error 18452, which could be
permissions among other things, but haven't found anything
detailed on how to fix this. The
server mode is Windows auth. I've tried various settings
in Web.config connection string, tried configuring IIS
Virtual Directory Managment setting Integrated Security
and I downloaded the .NET framework onto SQL server. I
still get the error.
Perhaps my workstation version of IIS is not configured
properly(?); do I need an IIS-server edition? I would
appreciate any help or reference to articles concerning
this problem (IIS config - VisStudio.NET - SQL
connectivity). Tag: MIcrosoft ODP Tag: 67198
Batch Query with Parameters
I'm using a stored procedure to retrieve hierarchical data from a database
for read only use. The stored procedure is:
CREATE PROC GetStringTable(@Token int) AS
SELECT * FROM StringTable WHERE Token = @Token
SELECT * FROM StringTableDetail WHERE Token = @Token"
When I use the "design surface" of the data access component to generate the
SqlDataAdapter (after setting the TableMappings manually) I can set the
Parameter value @Token with no problem.
However I'd like to code this without the design surface (with everything
local so the function can be shared/static). When I set the code:
Dim da As New SqlDataAdapter("GetStringTable", New
SqlConnection(ConnectString))
da.SelectCommand.CommandType = CommandType.StoredProcedure
da.TableMappings.Add("Table", "StringTable")
da.TableMappings.Add("Table1", "StringTableDetail")
da.SelectCommand.Parameters("@Token").Value = token
at runtime it fails, complaining that there is no parameter @Token in the
collection. Sure enough, the da.SelectCommand.Parameters collection is
initialized (not Nothing/null), but it contains zero items.
Is there any way to configure this DataAdapter to handle the multiple tables
with Parameters?
--- Jim --- Tag: MIcrosoft ODP Tag: 67192
Data objects as data structures
Hello there!
I'm learning ADO.NET and so far I'm quite impressed by the richness of
its object model up to the point that I started thinking about its
classes (at least those below System.Data - e.g. DataTable) as basic
data structures, unrelated to the existance of an underlying DB
instance.
What I mean is that I used to think about ADO just as an object model
hiding DB complexity from implementation; now I wonder whether some of
its classes could be used without any DB binding at all! As an example
think about a Monte Carlo application needing access to run-time
generated paths: storing this random data inside a DataTable instead
of arrays/lists/double* would allow advanced data selection,
constraints definition, creation of views... no matter whether the
data is eventually stored in a real DB (storing Monte Carlo paths
would probably be useless).
As far as I see the big odd with this approach is performance
overhead... any comment?
Thank you guys!
-- Marco -- Tag: MIcrosoft ODP Tag: 67191
View/Debug SQL Stmt Before Execution
Is there any way to output the completely populated SQL statement that is
about to be executed in ADO.NET? My SQL statements can contain and error
and I woulds like to debug them. Example:
Dim sqlSelect As String = "INSERT INTO Table(col1, col2) VALUES (@col1Value,
@col2Value)
Dim cmdTable As New SqlCommand(sqlSelect, cs)
...
cmdTerritory.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@col1Value", ...))
cmdTerritory.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@col2Value", ...))
' Debug Breakpoint Here
' IS THERE A WAY VIEW THE COMPLETE SQL STATEMENT TO BE EXECUTED???
cmdTerritory.ExecuteNonQuery() Tag: MIcrosoft ODP Tag: 67189
creating XSDs & DataSets via drag-drop
[originally attempted to post this on 9/23 but it never showed up]
me = XML newb
i am confused about one aspect of visually creating XSD's vs. XML
DataSets...
if i add a new DataSet to my project, then drag and drop the table onto the
designer, it creates a representation of that table in the designer.
simple.
BUT
if i add a new XML Schema to my project instead, then drag and drop the
table onto the designer, i get the table element as before, but it is also
parented to a 'Document' element which i didn't ask for, don't know the
purpose of, and don't want getting in my way...
why does it behave differently?
what is the purpose (advantage?) of the Document-level element?
which way is 'right'?
another question: other than this difference is there any other difference
between creating a DataSet vs. creating an .XSD then clicking 'Generate
Dataset'?
as always, any insight would be much appreciated! TIA all! =) Tag: MIcrosoft ODP Tag: 67188
How to Delete a child row using textboxes and datarelations
Hello,
I have a group of textboxes that display child table
information. How would I be able to delete the row from
the dataset?
Right now I have BindingContext set to my parent table
and therefore I could not so something like:
DataTable.Rows(bmbPosition.Position).Delete()
This would only return the Position of the Parent, I need
the child. I would like to keep this line in my code. I
do NOT want to do a rowfilter on an ID and then delete.
How would I delete a child row using a group of textboxes
that display the infomation that uses datarelations.
Thanks,
Charles Tag: MIcrosoft ODP Tag: 67187
calculated data fields could not be converted
Hello,
I use web-service, and also access for my database, and VB as my script of
web-service, and oleDBConnection to connect to database.
When I do query like this :
"select col1, col2, col3, ... from myTable"
...
mark = dr.getInteger(0) ' dr is the data-reader component.
...
... everything works fine,
but when I do a query as follows :
"select col1 + 10, col2, col3, ... from myTable"
...
mark = dr.getInteger(0) ' dr is the data-reader component.
...
... and trying running the query I get the following message :
'The data value could not be converted for reasons other than sign mismatch
or data overflow. For example, the data was corrupted in the data store but
the row was still retrievable".
What should I do in order to make things work on calculated fields ?
Thanks :) Tag: MIcrosoft ODP Tag: 67186
Any example to create a custom constraint?
Any example to create a custom constraint?
ForeignKeyConstraint and UniqueConstraint can not really fit my need.
DataTable.ColumnChanging and RowChanging events do not fit my need either.
Thanks for your help Tag: MIcrosoft ODP Tag: 67180
Need help with a query
I'm having trouble getting a particular query to work with ADO.NET. I want
to create a query where a returned field contains a certain string depending
on the which of several boolean fields in the database is true. I need a
function that will work in both Access 2000 and SQL Server, but I can't get
anything to work properly. I used to be able to do this with the Switch()
function with DAO and Access97. Does anyone know of a way to do this now
with both Access 2000 and SQL Server?
- Don Tag: MIcrosoft ODP Tag: 67177
OracleTransaction has no effect
Hi,
I use the OracleTransaction class. I use multiple OracleCommands
participating in the same OracleTransaction.
When one of the OracleCommands fail when executing and I do a rollback on
the OracleTransaction it does NOT rollback the previous commands. It seems
like the connection? is auto commiting each command I execute.
Does anyone know how to solve this?
Regards,
René Tag: MIcrosoft ODP Tag: 67172
Binding the date field to textbox
Hi,
I have the problem with binding the textbox with date field in the table of
the dataset.
The problem is that if the entered text in the textbox isn't of the correct
type (for example "dfhd" instead of "12.6.2003"), the text gets
automatically overwritten by the old value. That way the user has to type
everything all over again instead of just correcting the entered value.
Is there a way to prevent old value to overwrite the entered text?
I used the following code to bind the textbox to a dataview...
Dim objBinding As New Binding("Text", ds.NETBill.DefaultView, "Date")
AddHandler objBinding.Format, AddressOf FormatDate
txtDatum.DataBindings.Add(objBinding)
...and following code to validate entered text...
Private Sub txtDatum_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles txtDatum.Validating
If Not ControlValue.CheckValue (txtDate, ControlValue.ETip.tDate,
ds.NETRacun.DefaultView(0)) Then
e.Cancel = True
End If
End Sub
Regards,
Taras Tag: MIcrosoft ODP Tag: 67166
ADO OR ADO.NET
I am using VS.NET to develop one small software which based on Windowsforms.
The number of end user is less than 10. So I am wondering I should use ADO
or ADO.NET. Any suggestion is appreciated. Tag: MIcrosoft ODP Tag: 67153
Record locking Strategies? (ADO.NET)
Due to the disconnected architecture of the ADO.NET model
which are the recomended strategies for application which
requires record locking (for example a Online Ticket
Application)?
Thanks
Bill Tag: MIcrosoft ODP Tag: 67152
OracleClient special characters in column name
Hello
I am working with System.Data.OracleClient
How can I create a table with special characters in
column name ?
I have tried:
OracleCommand oCmd = new OracleCommand("CREATE TABLE
T1 ('_C1' number)");
oCmd.ExecuteNonQuery();
OracleCommand oCmd = new OracleCommand("CREATE TABLE
T1 (\"_C1\" number)");
oCmd.ExecuteNonQuery();
OracleCommand oCmd = new OracleCommand("CREATE TABLE
T1 (\\_C1 number)");
oCmd.ExecuteNonQuery();
OracleCommand oCmd = new OracleCommand("CREATE TABLE
T1 ({_}C1 number)");
oCmd.ExecuteNonQuery();
... but it does not work.
Thanks for replies. Tag: MIcrosoft ODP Tag: 67151
Connection pooling in Oracle
Hi,
How can I implement connection pooling in Oracle? I used .NET Framework 1.0,
Oracle .NET Provider 1.0 and Oracle Database 9i
Thanks for the help...
Eka Tag: MIcrosoft ODP Tag: 67149
Oracle .NET Provider 1.1
Hi all,
Where can I download Oracle .NET Provider 1.1? Is it available at all?
I need this because i got this error: "Failed to initialize distributed
transaction. Please see KB article Q322343."
I saw the KB already and it said that i need to download Oracle .NET
Provider 1.1 but I couldn't find it.
Thanks for help..
Eka Tag: MIcrosoft ODP Tag: 67148
Problem with the OleDb.OleDbCommandBuilder
Hi all,
Since my experience with sql is just beginning to grow
i use the commandbuilder object to generate updatecommands deletecommands
insertcommands.
With first run th update works without a problem
when i call my update function again (changing the same row again) i get
"Concurrency violation: the UpdateCommand affected 0 records."
Exception
The debugger shows that the dataset.datatable.row.rowstate = modified
But the update simply doesn't work
Does anyone know what i am doing wrong ?
any help would be greatly appreciated
Thanks & regards
Sven
Code:
For i = 0 to ds.tables.count -1
da.SelectCommand = New OleDb.OleDbCommand("SELECT * FROM " &
ds.Tables(i).TableName, mConnection)
comm = New OleDb.OleDbCommandBuilder(da)
da.UpdateCommand = comm.GetUpdateCommand
da.DeleteCommand = comm.GetDeleteCommand
da.InsertCommand = comm.GetInsertCommand
rowsaffected = da.Update(ds.Tables(i))
Debug.WriteLine("Updated table: " & ds.Tables(i).TableName & " affected
rows: " & rowsaffected)
Next Tag: MIcrosoft ODP Tag: 67144
Controls missing in the forms
Hi All,
I am developing an ERP Application in VB.Net. I have used a common
dataset and all the form level datasets are used the common dataset for the
"datasetname"property. But when I open the form, its dead slow to show the
design of the form. My system is P4, 256 MB RAM.
May I know the soluation for the same or welcome any suggestions?.
Also sometimes the control are missing while loading the form in the
design time. but the same control object is available in the genereated code
of the form.
Can u help me for the same??
Thanks,
Rethish Tag: MIcrosoft ODP Tag: 67141