ado.net

Can't activate message box with SQL data - ASP.NET

I am testing my knowledge of ADO.NET and SQL and am currently just trying to do the basics. I want to read from a table and when the user clicks a button, a message box pops up with the value in the ApplicationName column. It currently doesn't do anything when I click the button... any ideas? protected void TestSubmit_ServerClick(objec...

What is wrong with my ADO.NET code?

Can any one help me to identify the error in this program using ADO.NET... Code: using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SqlClient; using System.Transactions; // the code is showing an error in this line class Program { static void Main(string[] args) { try ...

SQL value does not populate ASP DropDownList control

I'm trying to populate a dropdown list control. 'Inputs' is the DB. Table is 'ApplicationName', and it has a random value assigned to it. For some reason, when I click the Test Submit button, nothing is appearing in the control (DropDownList1). protected void TestSubmit_ServerClick(object sender, EventArgs e) { // Initialize the da...

How do I read special characters from a file?

In C#, I am reading insert SQL statements from a text file and then trying to execute them on a database using ADO.NET. Several of the queries include a greek character in one of the columns. Specifically, Mu (funky looking u) that is used for microseconds (usec). The problem is that question marks are actually being inserted into the...

ADO.NET Connection Pooling and implications for AutoClose = True

Setup: I'm creating a .NET WinForms application in C# to allow our technical support folks to easily perform common tasks against our product's SQL Server 2005 database. The application is using ADO.NET (SqlConnection) to connect to the database. One concern in developing this application was to minimize the overhead of connecting/re-...

ADO.NET Entity Generation Wizard Taking Hours

Hello, I'm currently working with Visual Studio 2008 and the ADO.NET Entity Data Model Wizard. I'm connecting to a MySQL database using the MySQL/Connector plug in available. I have a database with 63 tables, each with foreign key constraints on several columns. I'm working on the data access layer for a multi-tier system. The ADO.NET ...

C# passing ref type parameter issue

Hello everyone, Suppose I have the following code snippets, i.e. goo call foo, DataTable created by goo and foo will only call Rows.Add. Then goo will use the updated data of the DataTable instance from foo. My question is, in my scenario, any differences or benefits compared of using with and using without ref parameter? I am using C...

Mixed mode on but still getting not trusted connection error

I'm trying to make a connection a sql 2000 db. Mixed mode is switched on and i can connect via query analyser to all users needed, however when i try and make a connection use ado it gives me this error: Login failed for user 'username'. Reason: Not associated with a trusted SQL Server connection. I have no idea why this is hap...

.NET DataReader and ORDER BY

Is it normal behaviour for a DataReader to return the rows from a query out-of-order? I'm fetching some rows from a PostgreSQL 8.3.7 database and am using ORDER BY, LIMIT and OFFSET as follows: SELECT id, name FROM tbl_foo ORDER BY name LIMIT 10 OFFSET 0; If I run this query manually the results are sorted and then the first ten rows...

WPF and databinding in a multi threaded ADO.NET app

I need advice and clarification please. I'm currently working on a monitor app that needs to show the contents of a database in a datagrid (I'm using the WPFToolkit grid btw). The grid binds to a table in my ADO.NET DataSet and it works fine. If I modify the DataSet through a button in my UI the grid updates and everyone is happy (bindin...

How do I filter SSIS custom component GUI for ADO.net Connection Types?

I have developed an SSIS custom task component. It uses a connection manager of the ado.net variety to do its database work. I'm in the processes of adding a GUI to the component and I can't find a way to filter/display just ado.net connections. I'm using the following code to load the connections into a list box. //Load up C...

Do any of the .net data classes implement INotifyPropertyChanged?

Short question: Do any of MS's built in Data Objects support INotifyPropertyChanged? Long explination: So I'm going to be displaying alot of data with databound controls. The data is going to be chaging somewhat frequently with user interaction. The application is a basic windows form app. Rather than wire up events for all the data to...

Can I save an 'Object' in a SQL Server database?

I want to save an object (of any type) into a field in a database in SQL Server 2005. Is it possible? Do I have to convert the object into something, like a byte array for example and cast it back when retrieving it? ...

Convert a byte[] array into DataTable

I saved an object of type DataTable into SQL 2005 database in a field of type varbinary. I want to retrieve it back but I wasn't able to type cast it. This is how i saved it. MemoryStream memStream = new MemoryStream(); StreamWriter sw = new StreamWriter(memStream); sw.Write(dt); con.Open(); using (SqlCommand cmd = new SqlCommand("...

Genericize command parameter creation when using null dates

I'm trying to genericize (if that's even a word) the following line of code: oCmd.CreateParameter("@Date", SqlDbType.DateTime, updateDate > DateTime.MinValue ? updateDate : SqlDateTime.Null); The first change is obviously SqlDbType.DateTime to just DbType.DateTime, what do I do with the SqlDateTime.Null? If I change to: oCmd.CreateP...

Is There Any Difference Between SqlConnection.CreateCommand and new SqlCommand?

In .Net, is there any functional difference between creating a new SqlCommand object and attaching a SqlConnection to it and calling CreateCommand on an existing SqlConnection object? ...

CRUD over aggregate root using traditional ado.net

Can anyone show me simple CRUD statements for aggregate root using traditional ado.net? Thanks in advance! ...

c# return resultset from Oracle store procedure and fill a DataTable

I'm a c# SQL Server developer new to Oracle programming. The code below works for setting cmdText to: "select * from myTable". I'd like to now put this in a stored procedure, I need help with how to write this Oracle stored procedure and get the results into a DataTable in my c# code. Thanks. Code: private DbProviderFactory DbFactory ...

How can I get an specific row or cell value from a DataColumn object with no using a DataGrid?

This is the code I have: Sub Main() Dim dts As New DataSet Dim da As New SqlDataAdapter Dim SolTabla As New DataTable Dim Columna As New DataColumn Cnx As New SqlConnection("Some Connection String") Dim vsql2 = "SELECT * FROM Table1 where code = '" & value & "'" da = New SqlDataAdapter(vsql2, Cnx) da....

How do you use SaveChanges() method in Ado.net Entity Framework?

I set up an IDataContext and when i create a data class for an entity, i inherit it from IDataContext. IDataContext interface has 4 methods. IQueryable<T> GetAll(); T GetById(long id); void Add(T entity); void Delete(T entity); void Save(T entity); As you know Delete and Save methods have this structure; FooEntities db = new FooEnti...