Capture SQL statements on Client side ADO.NET
Hi Everyone,
I have to capture & log all SQL statements on Client side ADO.NET. It is
not allowed to run SQL profiler against Oracle/SQL server.
It is a winform application based on .NET 3.5.
Could anyone please give me any idea about capturing&logging all SQL
statements on Client side ADO.NET?
Thanks a lot in advance,
Jin. Tag: Dotnet Viewers Tag: 145712
Missing parameter for data adapter select
Hi
I am using below in my dataadapter SELECT statement;
SELECT <field list>
FROM Clients
WHERE (Status = ?)
ORDER BY ID
What if I need all clients regardless of status, is there a way to modify
the above statement to include this situation or is a second query needed
for that?
Thanks
Regards Tag: Dotnet Viewers Tag: 145706
ANN: DBTyP.NET 2008 - Database Comparison Tool - New Release
This is a multi-part message in MIME format.
------=_NextPart_000_0049_01C8DD65.908B9000
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
DBTyP.NET 2008 Release 3=20
Vienna, Austria - June 28, 2008
Today, BYPsoft announced the availability of DBTyP.NET 2008 Release 3, =
the newest version of the cross-database comparison tool that compares =
SQL Server, MySQL and Oracle databases (schema and data). DBTyP.NET 2008 =
Release 3 is available for download from http://www.bypsoft.com.
With its rich support for schema and data cross-database comparison, =
DBTyP.NET takes the mystery out of databases, making their comparison =
practical and easy for programmers and database administrators =
everywhere. Over and above its powerful comparison capabilities till =
now, BYPsoft added to the DBTyP.NET 2008 support for schema comparisons =
for Oracle databases. Full cross database comparison family includes now =
support for SQL Server, MySQL and Oracle databases in the latest release =
of DBTyP.NET 2008 for a fraction of the cost of single-database =
solution.=20
Since the DBTyP.NET is under constant development, user interface has =
been redesigned and rich visual interface and easy-to-use features of =
DBTyP.NET 2008 allow developers and DBAs to identify and deploy changes =
quickly on all supported databases and enhance productivity and maximize =
results. Features like colorfull differences, different objects icons, =
visual column description, in place colorfull script differences, =
multiple views and more all save time and ensure accuracy.
In addition to all the new features listed above, in the latest release =
of DBTyP.NET 2008 BYPsoft includes also the following:=20
a.. SQL Server 2008 Ready=20
b.. Support for SQL Server ROWGUIDCOL=20
c.. Filtered out system objects on SQL Server databases.=20
d.. Support SQLServer user defined types.=20
e.. Support MySQL ENUM and SET data types.
We know that constant development is the key to progress, therefore we =
already started working on all new cool features. Stay with us.=20
------=_NextPart_000_0049_01C8DD65.908B9000
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.5583" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD><FONT face=3DArial><FONT size=3D2>
<BODY>
<DIV>
<DIV><STRONG><FONT face=3DVerdana>DBTyP.NET 2008 Release =
3</FONT></STRONG>=20
<H2 class=3Dwestern><STRONG><FONT face=3D"Verdana, sans-serif"><FONT =
size=3D2>Vienna,=20
Austria - June 28, 2008</FONT></FONT></STRONG></H2>
<P><FONT face=3D"Verdana, sans-serif"><FONT size=3D2>Today, BYPsoft =
announced the=20
availability of DBTyP.NET 2008 Release 3, the newest version of the=20
cross-database comparison tool that compares SQL Server, MySQL and =
Oracle=20
databases (schema and data). DBTyP.NET 2008 Release 3 is available=20
for download from <A=20
href=3D"">http://www.bypsoft.com</A>.</FONT></FONT></P>
<P><FONT face=3D"Verdana, sans-serif"><FONT size=3D2>With its rich =
support for=20
schema and data cross-database comparison, DBTyP.NET takes the mystery =
out of=20
databases, making their comparison practical and easy for programmers =
and=20
database administrators everywhere. Over and above its powerful =
comparison=20
capabilities till now, BYPsoft added to the DBTyP.NET 2008 support for =
schema=20
comparisons for Oracle databases. Full cross database comparison family =
includes=20
now support for SQL Server, MySQL and Oracle databases in the latest =
release of=20
DBTyP.NET 2008 for a fraction of the cost of single-database solution.=20
<BR><BR>Since the DBTyP.NET is under constant development, user =
interface has=20
been redesigned and rich visual interface and easy-to-use features of =
DBTyP.NET=20
2008 allow developers and DBAs to identify and deploy changes =
quickly on=20
all supported databases and enhance productivity and maximize results. =
Features=20
like colorfull differences, different objects icons, visual column =
description,=20
in place colorfull script differences, multiple views and more all save =
time and=20
ensure accuracy.<BR><BR>In addition to all the new features listed =
above, in the=20
latest release of DBTyP.NET 2008 BYPsoft includes also the following:=20
</FONT></FONT></P>
<UL>
<LI>
<P style=3D"MARGIN-BOTTOM: 0cm"><FONT face=3D"Verdana, =
sans-serif"><FONT=20
size=3D2>SQL Server 2008 Ready </FONT></FONT></P>
<LI>
<P style=3D"MARGIN-BOTTOM: 0cm"><FONT face=3D"Verdana, =
sans-serif"><FONT=20
size=3D2>Support for SQL Server ROWGUIDCOL </FONT></FONT></P>
<LI>
<P style=3D"MARGIN-BOTTOM: 0cm"><FONT face=3D"Verdana, =
sans-serif"><FONT=20
size=3D2>Filtered out system objects on SQL Server databases.=20
</FONT></FONT></P>
<LI>
<P style=3D"MARGIN-BOTTOM: 0cm"><FONT face=3D"Verdana, =
sans-serif"><FONT=20
size=3D2>Support SQLServer user defined types. </FONT></FONT></P>
<LI>
<P><FONT face=3D"Verdana, sans-serif"><FONT size=3D2>Support MySQL =
ENUM and SET=20
data types.</FONT></FONT></P></LI></UL>
<P><FONT color=3D#000000><FONT face=3D"Verdana, sans-serif"><FONT =
size=3D2>We know=20
that constant development is the key to progress, therefore we already =
started=20
working on all new cool features. Stay with us.=20
</FONT></FONT></FONT></P></DIV></DIV></BODY></HTML></FONT></FONT>
------=_NextPart_000_0049_01C8DD65.908B9000-- Tag: Dotnet Viewers Tag: 145703
Newbie question: Cstr vs toString
Hi
I have a WinForm app with a bound form. When user enters a value in field
rateid I lookup the respective rate amount from a table and assign it to
field rate.I am using the DLookup function to achieve this (full code given
below). This function returns a value of type object so I need to convert it
to string. If I use the function as below (using ToString) it works fine;
Me.txtRate.Text = DLookup(<parameters here>).ToString
but if I use it with a CStr
Me.txtRate.Text = CStr(DLookup(<parameters here>))
and then browse through 2-3 record the form stops showing data in the bound
fields. This brings me to question; what is the difference between CStr and
tostring that could be causing the above problem?
Thanks
Regards
=======
Function DLookup(ByVal SearchFld As String, ByVal SearchTbl As String, ByVal
SearchCriteria As String) As Object
Dim Cmd As OleDb.OleDbCommand
Dim Reader As OleDb.OleDbDataReader
Cmd = New OleDb.OleDbCommand("SELECT " & SearchFld & " FROM " & SearchTbl
& " WHERE " & SearchCriteria, DBConnection())
Reader = Cmd.ExecuteReader()
If (Reader.Read()) Then
DLookup = Reader.GetValue(0)
Else
DLookup = DBNull.Value
End If
Reader.Close()
Reader = Nothing
Cmd = Nothing
End Function Tag: Dotnet Viewers Tag: 145696
Count all records for all tables
Hi Experts
Hope Iâ??m in the correct thread.
Iâ??m using VS 2005 and the .NET Framework Data Provider for Oracle to connect
to an Oracle 7 database.
All is ok and I can view and run simple SQL like
SELECT COUNT(*) AS EXPR1
FROM ADDRESSES
Iâ??m trying to write some SQL that will count all the records in all the
tables. I have over 600 tables in the Oracle database.
Iâ??ve tried
SELECT OBJECT_NAME(id) AS Expr1, rows
FROM sysindexes
WHERE (indid IN (1, 0))
Which works ok when connected to SQL Server but not Oracle.
Any ideas? Tag: Dotnet Viewers Tag: 145689
How VS2008 DataSet generated works?
Hello,
I'm new in .Net world and there is so many info that I'm lost. DataSet is
creted by Visual Studio 2008 to handle a FireBird database. Where can I find
documentation about how to use theses classes in a better way?
What is the most efective way to use it: load table by table from the
database and DataSet handles it or is better create a composite query leaving
the work to the database and DataSet gets the relationship already done?
Thanks,
Marco Castro Tag: Dotnet Viewers Tag: 145688
Error occurred during the pre-login handshake
Hi all,
Can anyone tell me why in my production server get the error when I try to
open SqlConnection using ADO.NET? The error happen intermittent. My server is
running Windows Server 2003 and SQL Server 2005.
Below is the error:-
Source = .Net SqlClient Data Provider
Error = A connection was successfully established with the server, but then
an error occurred during the pre-login handshake. (provider: SSL Provider,
error: 0 - Not enough storage is available to complete this operation.) |
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
at System.Data.SqlClient.TdsParser.ConsumePreLoginHandshake(Boolean
encrypt, Boolean trustServerCert, Boolean& marsCapable)
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo,
SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64
timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean
integratedSecurity, SqlConnection owningObject)
at
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo
serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64
timerExpire, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String
host, String newPassword, Boolean redirectedUserInstance, SqlConnection
owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
at
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, SqlConnectionString connectionOptions, String newPassword,
Boolean redirectedUserInstance)
at
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo, String
newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open() Tag: Dotnet Viewers Tag: 145685
What does payload mean?
What does the term payload mean in the following links?
http://dotnetaddict.dotnetdevelopersjournal.com/adoef_vs_linqsql.htm
http://msdn.microsoft.com/en-us/library/aa697428(VS.80).aspx
Thanks for any help. Tag: Dotnet Viewers Tag: 145682
Read a Visual FoxPro dbf file.
Hi all.
I'm trying to open a dbf file which appears to be FoxPro. I've tried using
the OLE and ODBC classes but I'm not having any luck.
I keep getting an exception: "The Microsoft Jet database engine could not
find the object 'EQR_TRANSACTION_200803'. Make sure the object exists and
that you spell its name and the path name correctly."
Here is the ODBC code:
try
{
string connString = @"DBQ=C:\Test;Driver={Microsoft dBase Driver (*.dbf)};
DriverId=277";
OdbcConnection conn = new OdbcConnection(connString);
OdbcDataAdapter da = new OdbcDataAdapter("select * from
EQR_TRANSACTION_200803", conn);
DataTable table = new DataTable("table");
da.Fill(table);
dataGridView1.DataSource = table;
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
Any ideas?
Thanks,
Joe Tag: Dotnet Viewers Tag: 145680
Monogram Canvas Tikal GM M40077 - www.luxury-gift.org
Monogram Canvas Tikal GM M40077 - www.luxury-gift.org
Luxury Gift : http://www.luxury-gift.org
Louis Vuitton handbags : http://www.luxury-gift.org/Handbags/Louis-Vuitton-handbags.html
Monogram Canvas Tikal GM M40077 Link :
http://www.luxury-gift.org/Handbags/Handbags-7299.html
Monogram Canvas Tikal GM M40077 Information :
Brand : Louis Vuitton handbags
Code :
Description :
This soft and functional Monogram canvas bag is inspired by the Mayan
city in Guatemala. It features a shoulder strap and its ample space is
ideal for a shoulder strap and its ample space is ideal for everyday
essentials.- Golden brass pieces- Zipper closure- Inside patch pocket
with Twist Lock- Carried on the shoulder- Natural cowhide strapSize:
11.8" x 7.9" x 6.7"This Monogram Canvas Tikal GM Handbag comes
with:Serial and model numbers, the LV dust bag, care booklet, LV
cards, and copy of the genuine receipt from an official LV store.
Monogram Canvas Tikal GM M40077 Link :
http://www.luxury-gift.org/Watches/Handbags-7299.html Tag: Dotnet Viewers Tag: 145671
Balenciaga Giant City Bag Silver - www.luxury-gift.org
Balenciaga Giant City Bag Silver - www.luxury-gift.org
Luxury Gift : http://www.luxury-gift.org
BALENCIAGA handbags : http://www.luxury-gift.org/Handbags/BALENCIAGA-handbags.html
Balenciaga Giant City Bag Silver Link :
http://www.luxury-gift.org/Handbags/Handbags-8244.html
Balenciaga Giant City Bag Silver Information :
Brand : BALENCIAGA handbags
Code :
Description :
The giant gold hardware compliments the silver leather beautifully and
doesn't seem over-the-top on this particular size.Balenciaga actually
uses distressed leather which gives the bag the slouchy unique and
ultra chic look.The result is rocker chick with a sophisticated
twist.- Silver calf leather- Fully lined- Internal compartment with
zip closure- Balenciaga signature trademark and serial number stamped
inside- Double leather handles plus removable leather shoulder strap-
Zip closure with long leather zip-tassel,extra tassel included-
Detachable mirror - Antique brass hardwareMade in ItalySize: 15"W X
9"H X 5.5"D (W38 x H24 x D14 CM)Shoulder-strap/handle: 4.5" (11.5
CM)This handbag comes with: Balenciaga Dust bag, controllato card,
spare tassle, shoulder strap, cosmetic mirror and tags attached.
Balenciaga Giant City Bag Silver Link :
http://www.luxury-gift.org/Watches/Handbags-8244.html Tag: Dotnet Viewers Tag: 145670
Scripts failing without error
I have some simple scripts to create databases and add users/roles. The
scripts run just fine in Management Studio. When I run them programmitcally
they execute without any errors, however nothing happens; neither the users
nor the databases are created.
Here's an example for adding a user and setting role to sysadmin:
-- Get Major Version of Sql Server
-- 8 = Sql Server 2000
-- 9 = Sql Server 2005
DECLARE @version nvarchar(128)
select @version = LEFT(CONVERT(nvarchar(128),
SERVERPROPERTY('productversion')), 1)
-- Store traffic user and password
DECLARE @cmduser varchar(128)
DECLARE @cmdpass varchar(128)
select @cmduser = 'myuser'
select @cmdpass = 'mypassword'
DECLARE @userid int
-- Create user if doesn't exist
if @version = '9'
begin
--if not exists (select * from [master].[sys].[syslogins] where name =
@cmduser)
IF NOT EXISTS (SELECT * FROM sys.server_principals WHERE name = @cmduser)
begin
EXEC sp_addlogin @cmduser,@cmdpass
end
end
if @version = '8'
begin
-- Is there a proper way to do this in SQL Server 2000?
if not exists (select * from [master].[dbo].[sysxlogins] where name =
@cmduser)
begin
EXEC sp_addlogin @cmduser,@cmdpass
end
end
-- Give user system admin privileges
--EXEC master..sp_addsrvrolemember @cmduser, 'sysadmin'
EXEC master..sp_addsrvrolemember @loginame = @cmduser, @rolename = 'sysadmin' Tag: Dotnet Viewers Tag: 145666
Lookup in gridview
Hi
I have a gridview bound to a backend table A via dataset/data adapter. A
drop down is bound to a second table B. When user selects a value form drop
down I want to lookup another column in table B based on value selected from
drop down and assign the lookup value to a column in gridviw. How can I pick
the value selected by user and do the lookup from table B?
Thanks
Regards Tag: Dotnet Viewers Tag: 145665
Access database: How to set Isolation Level using System.Data.OleD
Hello!
How can I set the connection Isolation level for a Access database using
System.Data.OleDb?
In old days ;) of Visual Basic 6 and ADO we had the IsolationLevel property
in the connection object.
But in ADO.NET System.Data.OleDb I can't find anything to set the isolation
level!!
So, does anyone know how to set this ?
Thanks for your help and attention.
Jorge C. Tag: Dotnet Viewers Tag: 145663
UpdateRowSource.FirstReturnedRecord not working on .Net 2.0
I have a project that has been upgraded from .Net 1.1 to 2.0 and I cannot get
the UpdateRowSource.FirstReturnedRecord of the InsertCommand to work
correctly using the System.Data.OracleClient. It works correctly on 1.1 and
the DataSet is updated correctly after a DataAdapter.Update, but although the
insert happens to the database on 2.0, the DataSet is not updated.
My InsertCommand is a stored procedure that gets the next id (primary key)
for the tables instance, inserts the new record with the id, and then gets
the newly inserted row as an output.
The expected behaviour is the DataSet I passed into the Update method is
returned with the record containing the new id.
Has anybody run into this problem and found a work-around?
Regards,
Albert Tag: Dotnet Viewers Tag: 145657
Linq to Sql providers
I have two questions regarding Linq to Sql providers:
1. Are there any other besides MS SQL Server available?
2. How to program custom Linq to Sql provider? (Obviously I expect only some
guidelines and "getting started" type of advice.
Thank you in advance,
Roger Tag: Dotnet Viewers Tag: 145651
Closing Database connection in Window Service during System Shutdown
Hi All,
I am stuck up in a strange situation. I have a window service
responsible for some background database process.
Is there any possible solution to close open database connection when
server is re-booted ? Please see the source snippet I used.
protected override void OnShutdown()
{
//close database connection if any
ClassDatabase.CloseDBConn();
//Log to verify if Shutdown is called.
string strLog = "Service Shutdown.\t" + DateTime.Now.ToString();
CLogHelper.Log(strLog);
}
Is there any kind of limitation in OnShutdown Function? Any help would
be highly appreciated.
Regards
- Amit Gupta Tag: Dotnet Viewers Tag: 145647
app.config Connection string
Hi to all,
How can i change at design time My.MySettings.ESTConnectionString?, the
problem is that the Server and Instance can change when i run the program
for the first time, i am intending to build a form in order to users change
this parameters (Connection String, User and Password)
Thanks very much for helping
Joao
<connectionStrings>
<add name="appCHSocial.My.MySettings.ESTConnectionString"
connectionString="Provider=SQLOLEDB;Data Source=DOTNET-PC\SQLExpress;Initial
Catalog=xxx;User Id=sa;Password=xxx;"
providerName="System.Data.Sql" />
</connectionStrings> Tag: Dotnet Viewers Tag: 145645
ADO.net locks out SQL2000 user account under load
This is a strange problem to describe so you will have to bear with me! I
have developed a web application using c#.net that utilises server side ASPX
pages that connect to a SQL2000 database. I have been load testing my
application with the Microsoft Application Test Center that comes with Visual
Studio 2003, with simulated loads of 10 - 400 users.
When I run a test against my web application for upwards of 10 concurrent
users I start to get strange results from the database for what should be
routine queries. I execute a simple query looking for a row in a table which
I know is there (100% certain!) and the query returns the results to a
dataset. I then get the first datatable from the dataset and check that the
dataset.rows.count variable is greater then 0. Which it always is! I then
proceed to look for a column that exists in the table which I specifically
selected and an exception is thrown telling me the column doesnt exist in the
datatable. This is actually impossible the data is DEFINATLEY there!
I can log into SQL Query analyser as the same SQL logon that the ASPX page
uses to connect and run the same query and it returns the expected results
without error or anaomoly.
Once an error of this type has occured, I can replicated it upto 10 minutes
after it first has happened. During this 10 minute period I can switch the
SQL logon the ASPX uses and it runs fine. As soon as I switch it back to the
user on which the error occured it demonstrates the same problem again. After
10 minutes the problem disappears and wont happen again until I apply a heavy
load to the server.
As an important note, I have now managed to replicate an identical problem
with just 2 users trying to concurrently login.
Here is the snippet of code iam using to query the database:
public static DataSet execute_DataTable(String SQL_Command_String)
{
String connectionString;
connectionString =
getConnectionString(@"..\xml_Settings\DB_Connect.xml");
makeConnection(connectionString);
DataSet dsResults = new DataSet();
try
{
SqlDataAdapter dbAdapter = new
SqlDataAdapter(SQL_Command_String, dbConn);
dbAdapter.Fill(dsResults, "Results");
}
catch (Exception exp)
{
throw new Exception(exp.Message + " " + exp.StackTrace, exp);
}
finally
{
dbConn.Close();
}
return dsResults;
}
This function is located in a static class in a class library that compiles
to a DLL that is then referenced in my web project. Every time an ASPX page
requires to query the database this method is called.
When I load test my application a typical session will involve 2000 queries
in a very short period of time. This is because I use a recursive c# function
for generating a tree that executes alot of SQL queries.
Iam really out of ideas here guys , does any one have any ideas? All I can
think of is disposing of the dataset when iam done?
Thanks in advance!
Mike Tag: Dotnet Viewers Tag: 145644
http://cbt.googletoad.com | Free training Videos
http://cbt.googletoad.com
Microsoft, Cisco , Vmware , Oracle , Java and all kind of training
videos are here for free. Tag: Dotnet Viewers Tag: 145638
ADO.NET EntityFramework and Large SQL Databases
Hello.
This is my scenario. I am building a WinForm app. I have a 300+ tables
databases.
My problem comes everytime i have to build my app. it takes forever and i
guess the reason is that everytime that i compile, the system is compiling
the 300+ entities it just created. i found a bizarre solution to my problem
by having another project, a class library project, only for the model. Then
i unchecked the Build in the Solution properties so it doesn't get built all
the time. That's fine, but for some reason, i cant find the provider class
and also i am having other issues. i guess my question is... Is there a
DESCENT way to have the Entity model co-existing in peace in my Winform
project and do not wait up to 2 minutes everytime i need to build my app
(which happens about 300 times a day in test phase)
Any hint on this would be higly appreciated Tag: Dotnet Viewers Tag: 145637
how to identify the OleDb exception without relying on its message
I have written the code that allows to work with a password protected
Microsoft Access database as well as with regular (not password protected)
Access DB in VB. Net. I use OleDb objects. I need to identify whether a
current database is password protected, or not. For this purpose, I create a
regular connection string with no password set, and try to open the
connection. This piece of code is embedded into Try..Catch.. structure. If a
database is password protected, an OleDb exception is raised, with the
message "Not a valid password". To determine what is the reason of failure to
open a connection, I test the message property of the exception. If it
contains the string "Not a valid password", then I can conclude that the
database is password protected.
This code worked fine until we shipped our software to Netherland. I have
found that the message is now "Geen geldig watchwoord", and my code stopped
working.
The question 1: is there a way to identify the particular exception by an
universal attribute (like Error number) without relying onto its message
(which looks different in localized versions of OS)?
The question 2: is there an alternative way to find whether a Microsoft
Access database is password protected?
Thanks
Igor Tag: Dotnet Viewers Tag: 145636
.net hold query results?
Hello, friends,
We have a windows service which will query database through a web service
every one minute. If there are new records, this windows service will process
accordingly.
However, if there are no new records for a long time, say 2 days in weekend,
this windows service will no longer be able to retrieve new records anymore.
Although it still does the query, but return no records.
We then have to stop and restart this windows service to make it work again.
We believe .net hold query results somewhere, probably in web service.
Rather than actually going to the database to query again, it just returns
whatever cached in memory.
Are we right, and how to solve this problem?
Thanks a lot. Tag: Dotnet Viewers Tag: 145632
Always prompted to save when any Row is Modified
Hello, i have a problem relatrive to DataRowState.Unchanged, i have
the bellow code in my Save Button called by BSModificada()
'IF ANY CHANGE SaveData()
Private Sub BSModificada()
Me.Validate()
Me.TABMAINBindingSource.EndEdit()
Dim vDR As DataRow =3D CType(Me.TABMAINBindingSource.Current,
DataRowView).Row
If vDR.RowState <> DataRowState.Unchanged Then
SaveData()
End If
End Sub
'IF Added or Modifyed Update
Private Sub SaveData()
Try
Dim vvDR As DataRow =3D
CType(Me.TABMAINBindingSource.Current, DataRowView).Row
If vvDR.RowState =3D DataRowState.Detached Then
DBAdiciona()
ElseIf vvDR.RowState =3D DataRowState.Modified Then
DBModifica()
End If
Catch ex As Exception
clsUtilidades.ShowError(ex.Message, ex.ToString)
End Try
End Sub
In DBAdiciona() and DBModifica() i am always Accepting Changes by
Me.ESTDataSet.TAB_MAIN.AcceptChanges().
This code works good, until i try to see if any Change made when
closing the form, i am always prompted to save when any Row is
Modified even i click the save button and Accepting the Dataset
Changes, the code bellow on Form Closing
Private Sub frmEstatisticaMensal_FormClosing(ByVal sender As Object,
ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles
Me.FormClosing
Me.Validate()
Me.TABMAINBindingSource.EndEdit()
Dim vvvDR As DataRow =3D CType(Me.TABMAINBindingSource.Current,
DataRowView).Row
If vvvDR.RowState <> DataRowState.Unchanged Then
If MessageBox.Show("Altera=E7=F5es detectadas, quer gravar?",
"", MessageBoxButtons.YesNo, MessageBoxIcon.Question) =3D
Windows.Forms.DialogResult.Yes Then
e.Cancel =3D True
SaveData()
Else
e.Cancel =3D False
End If
End If
End Sub
Thanks for your time, any help will be welcome
Joao Tag: Dotnet Viewers Tag: 145629
"Database" missing in VS C++ 2008 CLR Windows Forms Application
In a Visual Studio 2008 C++ CLR Windows Forms Application, there is only
an "Object" icon, but no "Database" icon after
Data|Add New Data Source
In a Visual Studio 2005 C++ CLR Windows Forms Application as well as in
a Visual Studio 2008 C# CLR Windows Forms Application, a "Database" icon
is shown.
What do I have to do get this icon in a C++ CLR Windows Forms
Application to create a DataSet?
Thanks
Richard Tag: Dotnet Viewers Tag: 145628
LINQ Where 1=0
I have a asp.net gridview with a LinqDatasource.
When I do a delete the SQL profiler shows
DELETE FROM [dbo].[UsersInRoles] WHERE 0 = 1
The exception is:
[System.Data.Linq.ChangeConflictException] = {"Row not found or changed."}
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
onselecting="LinqDataSource1_Selecting"
ContextTypeName="ApplicationManagment.ApplicationsDataContext"
TableName="UsersInRoles" StoreOriginalValuesInViewState="False"
EnableDelete="True" EnableInsert="True" EnableUpdate="True">
</asp:LinqDataSource>
<cwp:GridView_Ex ID="gvUserInRoles" runat="server"
AutoGenerateColumns="False"
DataKeyNames="UsersInRolesID" DataSourceID="LinqDataSource1"
CanDeleteRows="True" CanEditRows="True"
>
In the datasource_selecting event I have:
ApplicationsDataContext ctx = new
ApplicationsDataContext(ConfigurationManager.ConnectionStrings["cnnApplicationManagement"].ConnectionString);
int[] iqueryAuthorizedApplications =
queryAuthorizedApplications.ToArray();
var queryRoles =
from
u in ctx.UsersInRoles
where
//get authorized and Filtered applications
iqueryAuthorizedApplications.Contains(u.ApplicationID)
&& //filter active
(chkActiveOnly.Checked == false ||
u.ApplicationRole.Application.DateRetired == null)
&& //filter application ddl
(ddlApplications.SelectedValue == "-1" ||
u.ApplicationID.ToString() == ddlApplications.SelectedValue)
&&
u.ApplicationRole.lutRole.IsPublicRole == true
&& // filter roles
(ddlRoles.SelectedValue == "-1" || u.RoleID.ToString() ==
ddlRoles.SelectedValue)
&& //filter Zno
(txtUser.Text == string.Empty || u.UserZno == txtUser.Text)
select u;
e.Result = queryRoles;
I saw in Scott G. Blog you can do this in the event and still have deleting.
How should I debug this?
In the exception handler I don't have access to the DataContext. Is their a
way to get the DataContext from GridViewDeletedEventArgs or the DataSource?
That way I could enumerate the context.ChangeConflicts. Tag: Dotnet Viewers Tag: 145626
Add Connection Dialog box
I'm using VB 2005 Express and am trying to set up a new SQL Server
connection using another server on my network. My problem is when I go to
set up a new connection and the Choose Data Source dialog box comes up only
MS Access and SQL Server database file choices are there. I'm stumped as to
how to address this limitation. I can connect and do what I need through
ADO. Net to any server but cannot set a persistent Data connection... seems
pretty odd.
I appreciate your help
Thanks
Paul Tag: Dotnet Viewers Tag: 145620
How do I insert sysdate into a column
I am using OLEDataAdaptor, DataTable and DataRow to insert a row like
dr["CREATEDDATE"] = ......
My question is how do I set that column to "Oracle sysdate"
TIA. Tag: Dotnet Viewers Tag: 145615
10 million visitors per month
10 000 000 uniques. ! unique = 1 page view. Site is ASP.NET 2.0 and SQL
Server 2005. 1 visit is 3-5 database access (smal number of fields with
datareader). No pictures or other multimedia, only text.
Can I run this on some good shared hosting like www.re-invent.com or
www.hostinguk.net or I need to VPS for this site? Tag: Dotnet Viewers Tag: 145609
CSV File with OleDB
Hello,
I am currently experiancing a problem with and OleDB connection to a CSV
file using C#. The file is in a folder with permissions set full to eveyone
and when users other that the administrator try to execute the following
code it returns "unspecified error" at the line containing "da.Fill(dt);".
When an admin user tries there is not a problem.
-------------------------------------------------------------
FileInfo fi = new FileInfo(@"E:\CSVFile\output.csv");
DataTable dt = new DataTable();
string optOutConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
fi.DirectoryName + ";Extended Properties='text;HDR=Yes;FMT=Delimited'";
using (OleDbConnection _OptOut = new OleDbConnection(optOutConStr))
{
string sqlTxt = "SELECT * FROM [" + fi.Name + "] WHERE [CompCounter] is
NOT NULL";
OleDbCommand cm = new OleDbCommand(sqlTxt, _OptOut);
OleDbDataAdapter da = new OleDbDataAdapter(cm);
da.Fill(dt);
}
-------------------------------------------------------------
Thanks,
-Scott Tag: Dotnet Viewers Tag: 145606
Strongly typed Datasets and TableAdapter separation.
Hi,
I would like to have all my strongly typed datasets in a classlibrary.dll
and share the DLL across all solution tiers. The serious problem with this
approach is that I cannot separate TableAdapters from DataSets.
Is there any possible way to separate TableAdapter s from strongly typed
datasets?
Any help would be appreciated,
Max Tag: Dotnet Viewers Tag: 145603
How to determin if a datarow has already been added to a datatable yet.
using .net 3.0 and c#, I have a public datarow from a strongly typed dataset
datatable. the datarow gets created using the method
myTable.NewmyTableRow(), but doesn't get added to the table until later. At
some point later, is there a quick and easy way determine if the datarow has
already been added to the datatable yet?
--
moondaddy@newsgroup.nospam Tag: Dotnet Viewers Tag: 145599
Dataset designer uses username as schema
I've created a typed dataset. I've dragged some tables onto the
dataset. When configuring the corresponding table adapter, Visual
Studio is generating SQL script code such as...
CREATE PROCEDURE DOMAIN\UserId.StoredProcName
AS...
The userid is being used as the schema, it is invalid syntax. My
userid is set to use dbo as the default schema, why is dbo not being
used in the script?
Using SQL 2005, Visual Studio 2005. Any ideas? Thanks
Adam Tag: Dotnet Viewers Tag: 145592
Problems with strongly typed dataset not working
The program below clearly populates the data set as seen by dumping the XML.
I'm using strongly typed data sets.
(1) Why does not my loop to dump row by row work? The record count is zero!
This is clearly wrong from the XML that is dumped!
(2) Why does not my attempt to add a new row work? I don't see "sari" in the
xml or the database when I am done!
Thanks
Siegfried
Dim sqlConnection As New System.Data.Odbc.OdbcConnection(cs)
Dim sqlCommand As New System.Data.Odbc.OdbcCommand(sel, sqlConnection)
'Dim ds As New DataSet()
Dim ds As New OdbcSimple_mdb4
Dim da As New System.Data.Odbc.OdbcDataAdapter(sel, sqlConnection)
da.Fill(ds)
Dim dt As DataTable = ds.Tables(0)
' Use the constructor that takes a type and XmlRootAttribute.
Dim ser1 As New
Xml.Serialization.XmlSerializer(GetType([OdbcSimple_mdb4]))
Dim tw1 As TextWriter = System.Console.Out
ser1.Serialize(tw1, ds)
#If noprompt Then
outp.WriteLine("exiting DisconnectedRS.vb")
#Else
outp.Write("Enter any key to continue DisconnectedRS.vb: ")
_getch()
#End If
Dim t As OdbcSimple_mdb4.simpleDataTable
t = ds.simple
outp.WriteLine("row count = " & t.Rows.Count)
Dim r As OdbcSimple_mdb4.simpleRow
For Each r In t
outp.WriteLine(r.sDescription & "," & r.dtCreation)
Next
r = t.NewRow
r.dtCreation = New DateTime(2008, 6, 18)
r.sDescription = "Sari"
ds.simple.AcceptChanges()
Dim ser2 As New
Xml.Serialization.XmlSerializer(GetType([OdbcSimple_mdb4]))
Dim tw2 As TextWriter = System.Console.Out
ser2.Serialize(tw2, ds) Tag: Dotnet Viewers Tag: 145584
Problem with LINQ update
Hi All
I have a view in my DB which returns records with no unique identifier. So i
am not able to set the primary key. For example i have three tables
(customer, order, address) which are joined in the view and my result set has
customer data replicated. To display in the screen am doing Distinct and
where customer Id = 1 and getting the company details. but when i have to
update since there is no primary key my update fails.....any idea how to work
around this....... Tag: Dotnet Viewers Tag: 145583
Problem wiht ado net 2.0
I'have a problem. Ado net 2.0 is resulting very slowly. I'vemade a
test in which i write 100000 record in a database with VB6 Dao and
with VB2005 ADO net 2.0. In the first case the time elapsed for the
operation is 2 second, in the second case the time elapsed is 2
minutes. Can anyone help me to find where i wrong (if i wrong
something...).
in particulary the most part of the time is used for complete the
Update method.
The vb2005 code tha i've use for the test is this:
----------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.Label1.Text = Now
Dim ds As New dbprovaDataSet
Dim tab As dbprovaDataSet.tabella1DataTable = ds.tabella1
Dim riga As dbprovaDataSet.tabella1Row
Dim i As Integer = 0
For i = 1 To 100000
riga = tab.Newtabella1Row
riga.campo = i
tab.Addtabella1Row(riga)
Next
Me.Label2.Text = Now
adap.Update(tab)
Me.Label3.Text = Now
MsgBox("fine")
End Sub
---------------------------
thank U for Help and excuse me for my bad english. Tag: Dotnet Viewers Tag: 145581
dataset
What is the best way to handle disposing of a DataSet or DataReader within a
function that returns either? Or should i just trust that its gone when it
goes out of scope? Tag: Dotnet Viewers Tag: 145578
how to insert NCLOB value with System.Data.OracleClient
Hi,
I am trying to use an OracleParameter object to insert a value into an NCLOB
column - the value is stored as a string variable in c# and contains
non-ansi characters.
from what I can understand, I need to set the OracleType property which also
sets the DbType property in the superclass
if I set the OracleType to be nvarchar, some values seem to insert Ok but
some others give this error:
ORA-01461: can bind a LONG value only for insert into a LONG column
it doesn't seem completely dependent on the length of the data but I presume
this is the underlying problem.
so I have tried setting OracleType = OracleType.NClob. however, this gives
ORA-01084: invalid argument in OCI call
any idea how what I am doing wrong? FWIW i'm connected to 10g rel 10.2.0.1.0
and my code looks like this:
IDbConnection conn = new OracleConnection();
conn.ConnectionString = "...";
conn.Open();
IDbCommand cmd = conn.CreateCommand();
cmd.CommandText = "INSERT INTO xxx (xxx) VALUES (xxx, :1, xxx )";
IDbDataParameter param = cmd.CreateParameter();
param.ParameterName = ":1";
param.Value = "xxx";
((OracleParameter)param).OracleType = OracleType.NClob;
param.Direction = ParameterDirection.Input;
cmd.Parameters.Add(param);
cmd.ExecuteNonQuery();
Thanks
Andy Tag: Dotnet Viewers Tag: 145574
Create Diffgram Based on 2 Different XML Files or Data Sets
I have an xml file that my application downloads on a periodic basis. I also
have a dataset based on this that is used in the application. At present,
the application takes the new downloaded xml, creates a data set from that
and merges it with one in use. The ultimate goal is to have the update of
the primary data set trigger change events based on only data that has
changed (updates, additions, or deletions).
I am thinking that I need to generate a diffgram based on the current data
and the newly downloaded data and then apply that to the current dataset. Is
this the propper approach, and what is the best way to do this. I am seeing
some postings regarding an XMLDiffPath tool, but they are several yeares
old. How is this done now?
TIA
--
Howard Swope [ mailto:howard.swopeATnavteqDOTcom ]
Technical Lead
Media Development
Navteq Traffic [ http://www.navteq.com ] [ http://www.traffic.com ] Tag: Dotnet Viewers Tag: 145572
LINQ to SQL, over ASP.NET, DataContext.GetTable trouble
Hi,
Working with LINQ to SQL over an ASP.NET application (VS2008, .NET 3.5)
while calling
"MyDataContextInstance.GetTable<MyTable>()"
it produces sometimes the following exception:
"an item with the same key has already been added"
I think is some trouble about concurrency or async calls
(MyDataContextInstance is an static variable).
Could it be a problem related to ASP.NET application lifecycle management?
or...
a LINQ to SQL (DataContext) bug not supporting concurrency?
Thanks in advance for your time.
Néstor Sánchez A. Tag: Dotnet Viewers Tag: 145565
Dataset and XML
Hi Gurus,
I have a very simple question. Please answer.
Is it true that when we load Data into a Datasets from SQLServer it loads it
in XML format?
I am curious to know how it loads data.
I appreciate any knowledge I gain.
Thanks
Mark Tag: Dotnet Viewers Tag: 145563
ExecuteDynamicInsert Bug
I'm trying to simulate an "ON INSERT" AND "AFTER INSERT" trigger in LINQ
the code I use is this:
partial void InsertEvent(Event instance)
{
Group group = new Group();
group.GroupId = Guid.NewGuid();
group.DateCreated = DateTime.Now;
group.OwnerId = instance.OrganizerId;
group.Name = instance.Title + " Event Group";
group.Description = instance.Description;
group.Permission = 3;
base.ExecuteDynamicInsert(instance);
///this will fail because the database is unable to check the
constrain
///on groupEvent.EventId
///
///
NewDataContext context1 = new NewDataContext();
GroupEvent groupEvent = new GroupEvent();
groupEvent.GroupEventId = Guid.NewGuid();
groupEvent.GroupId = group.GroupId;
groupEvent.EventId = instance.EventId;
context1.GroupEvents.InsertOnSubmit(groupEvent);
context1.SubmitChanges();
}
base.ExecuteDynamicInsert(instance); lock the table in which instance is
inserted
so the constraint groupEvent.EventId = instance.EventId; on sql cannot be
verified and the insert of GroupEvent fail....
any idea on how to do it? Tag: Dotnet Viewers Tag: 145562
Visual Studio 2008 SP1(beta) - ADO Entity Data Model template is not available.
Hi All
I want to try out this tutorial
http://blogs.microsoft.co.il/blogs/bursteg/archive/2008/05/12/visual-studio-2008-sp1-ado-net-data-service-walkthrough.aspx
with the new ADO Data Service (code name Astoria). When I hit step 2, I
can't find any item template ADO.NET Entity Data Model. Has anyone seen this
problem with their installation of VS SP1 beta.
Cheers,
tc Tag: Dotnet Viewers Tag: 145547
How to move table definitions?
What is the easiest way to move table definitions between various databases?
For example: if I have a excel spreadsheet with column headers, how can I
move the table definition (excel seems to be able to detected data types like
dates and integers and strings) to MSAccess or SQL server or MySQL?
I was going to interrogate the data set for the column types and use ADOX to
create the table definitions. The data set won't give me primary key and
foreign key information though. Is there an easier way?
Thanks,
Siegfried Tag: Dotnet Viewers Tag: 145546
Best way to reinvent bulk insert?
Which is more efficient: a long series of SQL INSERT statements or
deserializing a dataset from XML and saving it to the table?
If I fill a dataset with current sample data and serialize it to XML, can I
expect to use that as a template to subsequently populate the table in the
future?
This way I can keep the XML under version control as well.
What function to I call to save a deserialized data set to a table?
We have been using bulk insert with sqlcmd but that is difficult to debug
and is specific to SQL Server. Tag: Dotnet Viewers Tag: 145540