ado.net

Can I provide a datable row with a name?

Is it possible to provide datatable rows with names in string form as one does with columns? I want to be able to refer to a row via a name rather than an index. EDIT: My bad. I am working in C#. I should have stated that. I am doing market correlation studies using statistical analysis. I want to store the outputs of correlation stu...

Is something with my logic in this ADO.NET code? it is always return false?

This is a simple function that returns TRUE if the user exists in the users table, false otherwise. For some reason it is always return false, I even removed the WHERE clause and I still get false? (a manual check in query analyzer tells me I have lots of rows?) Public Shared Function DoesUserExist(ByVal userID As Integer) As Boolean ...

Getting nonsensical results from SQL query

Hi, I've encountered a very, very strange situation in my application. I say strange because the errors are intermitent and I cannot find out why they occur. I've pass a sqlcommand to the DB (Sql 2005) trying to get a bigint (column ID_Facultate) from a single table. The problem is that I've got a string (the name of some lecture) that...

Binding a wpf listview to a Dataset....Possible..?

Hi, I was struggling moving to Wpf,I am just stuck while trying out databinding to a lsitview.I want to databind a listview to a dataset(dataset because the data i want to display in columns belongs to different tables).I am attaching a sample code that i am trying with.It works alright but the listliew only shows one row.What could be w...

ADO.NET Connection Problem

Hi i am getting this error while tryin to connect my web site. Unspecified error Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb....

How do you use hiearchy datatype with ADO.NET Entity Framework?

Hi, I'm trying to model a hierarchy using the new hierarchy data type in SQL Server 2008. When I move the table into my EF model, the hierarchy column doesn't show up as something that can be mapped or as a property in the entity. Because I'm using ASP.NET MVC, I'm using the EF framework as the primary way to access data. Any ideas? ...

Debugging/solving MSDTC promotion error

What is the best way to attempt to debug and pinpoint the code causing a SQL transaction to be elevated to a DTC? I'm working with an existing API that is failing for me alone, so i believe it to be some kind of config error or something wacky. I'm not having much luck finding the culprit via debugger. Are there better ways to find the o...

how to insert,delete and update data in database using ado.net in Vb.net (database MS access)?

Imports System.Data Imports System.IO Imports personal_dtls.perds Imports personal_dtls.perdsTableAdapters Private Sub insert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles insert.Click Dim adapter As New perdsTableAdapters.Daily_AttndTableAdapter adapter.InsertQuery("as", "asd", "...

ADO.NET DataRow - check for column existance

How do I check for the existence of a column in a datarow? I'm building datatables to organize some data that I've already pulled back from the db. Depending on the type of data in each row I need to create a datatable with different columns. Then later on I want to check and see if the datatable i am looking at has a certain column. ...

What size do you use for varchar(MAX) in your parameter declaration?

Hi, I normally set my column size when creating a parameter in ADO.NET But what size do I use if the column is VARCHAR(MAX)? cmd.Parameters.Add("@blah", SqlDbType.VarChar, ?????).Value = blah; ...

how to define where my MDB database is stored in local hard disk (VB.NET)

VB.net seem to place my database file into /userprofile/local settings/apps/2.0/data/random/random/appname/data/ folder. Can I define easier location for my published app. I am also worried that when upgrading this database is ignored or something bad happens? ...

How to make Oracle Query recognizable to ASP.NET table adapter?

I have a query with a sub query in the select that needs to get a value from a certain table if it exists. I don't want to paste the query here for business reasons, but here's a simplified example of what I am trying to do: select a, b, (select x from z) as c from table where ... The query runs fine in TOAD, but when I go through t...

Saving 1000+ records to the database at a time

I'm using NHibernate currently. I have a situation where I need to save a bunch of records to the database like this: var relatedTopics = GetRelatedTopics(topic); foreach (var relatedTopic in relatedTopics /* could be anywhere from 10 - 1000+ */) { var newRelatedTopic = new RelatedTopic { RelatedTopicUrl = relatedTopic, TopicUrl = t...

DataColumn.Expression Power

the following code Dim dc = New DataColumn(name, GetType(Double), "[col1] ^ [col2]") produces the following error: The expression contains unsupported operator '^'. Is this right, is the power operand not support in datacolumn expressions??? Anyone have an idea how i'd write this? ...

Can Linq to SQL coexist with ADO in SQL Server Express?

I have a single-user Win Forms application that uses an SQL Server Express database via ADO.NET. I want to add more to my app, but by using Linq to Sql (while I learn Linq to Sql). I am unable to see the database in two places simultaneously. Either I can see it in the original code using ADO, or I can see it with the new code using L...

Accessing huge data from Remote Server in C#

Hi, I have a database based in NY and my HK users are trying to get the data from this database. The data retrieved is approximately 20 mb (if you save the Datatable as csv the file size is 20 mb). It is taking around 20 mins for the data to come. I am using SQL Server 2005 as database and c# as desktop application. I cannot have a se...

DbCommand & Parameters: Get the actual executed SQL (Parameter values filled in)

Using a .NET DbCommand (eg OracleCommand, SqlCommand, ODBCCommand, etc) object with Parameters, how can I get the SQL that will actually be executed - ie with the parameter values filled in? I could certainly write my own search / replace method, but that is incredibly close to just re-writing the logic behind the parameters. (Specifica...

Whats ADO.Net Data Services? and how it can help me while building ASP.Net websites?

Whats the ADO.Net Data Services ? Whats the advantages it will give me while building an ASP.Net website. I used to make my JavaScript client side code call a web service and get back a json for Ajax calls on my page. Is ADO.Net Data Services something which will help me in this scenario, it can simplify returning the data or its talk...

How to manually load EntityReference without using EntityReference.Load()

I have entity type Order which has a reference to an entity type Customer. There's a function import that return a list of Order based on a criteria. This list of Orders in displayed in a Datagrid which shows Order.Date | Order.Customer.Name | Order.Total For Customer.Name to show up I need to load the CustomerReference in each Order i...

How to sort related entities with eager loading in ADO.NET Entity Framework

Greetings, Considering the Northwind sample tables Customers, Orders, and OrderDetails I would like to eager load the related entities corresponding to the tables mentioned above and yet I need ot order the child entities on the database before fetching entities. Basic case: var someQueryable = from customer in northwindContext.Custo...