i have a datable and like this i have searched a datarow from the datable on the basis of some primary now i want to add that searched row to another datatable how can i achieve this please let me know
DataTable findRows = (DataTable)ViewState["dt"];
List<int> selectedList=(List<int>)ViewState["selectedList"];
DataTable temp = new Da...
How do you create DataRow instances that aren't tied to any particular DataTable instance?
(EDIT: I know you can create DataRows using the DataTable.NewRow() method, but the problem is that I can't seem to disconnect the row from its parent table so I can pass the individual row around without having to pass the entire table around)
...
I am using C#, VS 2005 and SQL 2000
My code is:
StringBuilder sb = new StringBuilder();
sb.Append("insert into dummy(name,amount)values");
foreach (Control ctl in this.flowLayoutPanel1.Controls)
{
if (ctl.Name.Contains("tb") && ctl is TextBox)
{
sb.Append(ctl.Text);
}
}
foreach(Control bbl in this.flowLayoutPanel1.Contro...
I have application with following data flow:
SqlDatabase -> SqlDataAdapter + SqlCommandBuilder -> DataSet -> DataGridView
All conversions and bindings are automatic.
This is all simple and functional and I can load all kinds of databases with simple code. Problem is with BLOBs, they are treated as Image in DataGridView. My question is...
I installed SQL Server 2008 Management Studio, and uninstalled 2005 as a consequence my .net application with a local SQL Server express doesn’t work anymore. I tried with nothwind 2008 sample at my App_Data folder. The connection string is :
Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated Security=Tr...
I'd quite like to use ADO.NET to generate a CREATE TABLE script to create an exact copy of a given table.
The reason for this is persistence testing. I would like to know whether my application will persist to a particular database. I would like to be able to point the app to the database and table in question, and then the app will gen...
How can I map properties of a type with no NHibernate mapping?
How should I manage the dependencies on old data access logic during the transition?
The application uses ADO.NET to invoke sprocs for nearly every database operation. Some of these sprocs also contain a fair amount of domain logic. The data access logic for each domain e...
Suppose i have this sql statement and I have executed a sql command to get a datareader:
"select 1 union select 2"
//.....
var rdr = cmd.ExecuteReader();
and now i want to read the value in the first column of the first row:
var myInt = (int)rdr.GetValue(0); //great this works
var myLong = (long)rdr.GetValue(0); //throws cast excepti...
Why the error does not appear at the UI layer? I am using ExecuteScaler
BEGIN CATCH
PRINT N'The transaction is in an uncommittable state. Rolling back transaction.'
ROLLBACK TRANSACTION;
DECLARE @ErrorMessage NVARCHAR(4000);
DECLARE @ErrorSeverity INT;
DECLARE @ErrorState INT;
SELECT @ErrorMessage = ERROR_MESSAGE(),
...
i want to manage session on window form .
...
I've recently started to use the Entity Framework 4.0 in my .NET 4.0 application and am curious about a few things relating to pooling.
Connection pooling as I know is managed by the ADO.NET data provider, in my case that of MS SQL server. Does this apply when you instantiate a new entities context (ObjectContext), i.e. the parameterle...
Say i have a stored proc that inserts some data into a table. If data is duplicate it will cause a sql server error (because i have unique index on some columns) and this error causes an exception in SqlClient. What can i do inside the stored proc to handle the error so no exception is being generated in my data access code?
...
We have a query for about 40 data fields related to customers. The query will often return a large amount of records, say up to 20,000. We only want to use say around the first 500 results. Then, we just want to be able to page through them 10 at a time.
Is LINQ skip and take a reasonable approach for this? Are there any potentnialy...
In our applications we don't use either ADO.NET transaction or SQL Server transactions in procedures and now we are getting the below error in our website when multiple people are using.
Transaction (Process ID 73) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim...
How to develop program/website and minimize DB dependencies using C#.NET?
For example I have made some changes in my DB, after that I must rewrite half a project.
...
I'm working on a project to replace ADO.NET data access logic using NHibernate where we're not able to map the entire domain model at once. This means we'll have domain classes with property mappings to other domain classes that aren't yet mapped with NHibernate.
Consider a Person class with an Address property (Address being a domain ...
We're (slowly) moving an application (with a classic ADO.NET DAL) to NHibernate (following both "one-session-per-request pattern" and "repository pattern").
The application, right now, is in a hybrid state (I know, it's horrorful):
some query are made by disposable DAO objects (that open a connection in their constructors and dispose ...
My function isn't returning anything - strReturn is empty:
try
{
SqlParameter[] parameter = new SqlParameter[]
{
new SqlParameter("@MerchantID", MercahntID),
new SqlParameter("@LoactionID", LoactionID)
};
SqlHelper.ExecuteNonQuery(DbConnStri...
I want to implement the below mentioned problem in Entity Framework.
I have 2 tables( below are their simplified versions)
items table
itemId,itemName
tags table
tagId,tagName
my logic is, an item can have more than one tag and a tag can have more than one item related to it, so I have added many to many relation (please correct...
Hi,
We are starting a new project, wich talks to an Oracle database with millions of data. The system is mission critical and should be highly performant. We are now choosing the technologies that will be involved in the system, and we are doubting between JDBC or ADO.NET for data access.
Wich technlogy is most performant? Are there a...