I am doing a really simple query in ASP.NET, but after I inserted the LIKE clause it stops working.
Example:
String sql = " SELECT *
FROM Products
WHERE ID = @MYID
AND Name LIKE '%@MYNAME%' ";
SqlCommand command = new SqlCommand(sql, cn);
command.Parameters.AddWithValue("@MYID", M...
I'm looking for suggestions as well as any benchmarks or observations people have. We are looking to rewrite our data access layer and are trying to decide between native C++ OLEDB or ADO.NET for connecting with databases. Currently we are specifically targeting Oracle which would mean we would use the Oracle OLE DB provider and the OD...
Hi,
(a)- Is their any possibility that I can map two tables from the different database ( say sql server 2005 and oracle 10g) through aso.net entity framework.
also, one more query
(b)- I have worked around on the difference between entity framework & linq and I found that to use entity framework when we have one to many or many to man...
Hello everyone
Every now and then we get this very weird error
NHibernate.ADOException: could not execute query
[ SELECT this_.Id as Id37_0_, this_.AREA_ID as AREA2_37_0_, this_.BAT_CHK as BAT3_37_0_, this_.BAT_COD as BAT4_37_0_, this_.BBEACT as BBEACT37_0_, this_.CREDATE as CREDATE37_0_, this_.DEST_LOC as DEST7_37_0_, this_.DOCNR as DO...
I am coding a simple space empire management game in Visual C# 2008, which relies on connecting to a remote SQL server database to get/store data.
I would like the user to be able to connect to a user-specified SQL server from the login screen(he specifies IP address, port, database name, ID, password and presses "connect" button). How...
Driving me mad on a personal project; I know I've done this before but elsewhere and don't have the code. As far as I can see, I'm setting the parameter, I'm setting its value, the connection is open, yet when I try to fill the dataset I get the error 'Procedure or function expects parameter "@test" which was not supplied'.
(This is o...
Hi All,
In the below code,
using (SqlDataReader dr = com.ExecuteReader(CommandBehavior.CloseConnection))
{
while (dr.Read())
{
_emailTemplate.EmailContent = dr["EMAILCONTENT"].ToString();
_emailTemplate.From = dr["EMAILFROM"].ToStri...
I'm using SqlBulkCopy to insert into a table with IGNORE_DUP_KEY on. This means that exceptions aren't thrown when duplicate is encountered, instead it passes over it and continues.
Is it possible to get feedback on which rows were inserted or ignored?
...
I need to write a simple C# .NET application to retrieve, update, and insert some data in a Sharepoint list.
I am NOT a Sharepoint developer, and I don't have control over our Sharepoint server. I would prefer not to have to develop this in a proper sharepoint development environment simply because I don't want to have to deploy my appl...
Hi,
I was wondering how to return plain XML from ADO.net data services
I have exposed an ADO.net data service to different DEPARTMENTS in our company who are not so technical. The data returned is ATOM FEED which is kind a hard to read / interpret with its format, too much information is returned
people from various departments would ...
I need to implement nested transactions in .NET using ADO.NET.
The situation is as follows:
--> Start Process (Begin Transaction)
--> Do DB things
--> Begin Transaction for step 1
--> Step 1
--> Commit transaction for step 1
--> Begin transaction for step 2
--> Step 2
--> Rollback transaction for s...
I am using a combination of the Enterprise library and the original Fill method of ADO. This is because I need to open and close the command connection myself as I am capture the event Info Message
Here is my code so far
// Set Up Command
SqlDatabase db = new SqlDatabase(ConfigurationManager.ConnectionStrings[Connecti...
For some reason it takes 7 seconds to open a connection to a sql server database for the firt time, subsequent connections takes a second. any idea what could be the reason?
I'm using C# and asp.net
Its after compilation, i essence every time i restart the site, which means every time it needs to actualy create the "first" connection....
So, I'm starting a new Project in my company, and it's kinda big. We are going to use .NET 3.5, and I wish to known if there are any know bugs or perfomance issues that could give weird behaviour for my project? I'm reading some things about EFv4 and all they say is that EFv3.5 have too many problems.
After all, what's the best and fast...
Hello,
I have several linked tables (entities). I'm trying to get the entities using the following linq:
ObjectQuery<Location> locations = context.Location;
ObjectQuery<ProductPrice> productPrice = context.ProductPrice;
ObjectQuery<Product> products = context.Product;
IQueryable<ProductPrice> res1 = from pp in productPrice
...
I want to show the user detailed progress information when performing potentially lengthy database operations. Specifically, when inserting/updating data that may be on the order of hundreds of KB or MB.
Currently, I'm using in-memory DataTables and DataRows which are then synced with the database via TableAdapter.Update calls. This w...
In order to fill a datagridview according to the selectedvalue of a combobox I've tried creating a stored procedure. However, as I'm not 100% sure what I'm doing, depending on the WHERE statement at the end of my stored procedure, it either returns everything within the table or nothing at all.
This is what's in my class:
Public Functi...
Why MS Access adodb in .NET returns 34 in fieldcount when table has 42 fields ?
I see 42 fields in table of my MS Access mdb database. But ADODB layer in .NET sees only 34 fields. The Outofrange exception occures when I am calling method getOrdinal("FieldName") of reader class.
Is it something I am missing in setting up connection, lic...
Can you use 2 'using' statements like:
using (SqlConnection ..)
{
using(SqlDataReader reader = new SqlDataReader())
{
}
}
I'm trying to do this put getting an error on the constructor of the SqlDataReader
...
Here is an example of my code in a DAL. All calls to the database's Stored Procedures are structured this way, and there is no in-line SQL.
Friend Shared Function Save(ByVal s As MyClass) As Boolean
Dim cn As SqlClient.SqlConnection = Dal.Connections.MyAppConnection
Dim cmd As New SqlClient.SqlCommand
Try
cmd.Conne...