I am having trouble with a ALTER TABLE command that I am trying to use on a MS Access database in a C# project. I am trying to rename a column and change the type at the same time.
Here is my command:
string sqlCommand = "ALTER TABLE " + tableName + " CHANGE [" + oldColName + "] ["
+ newColName + "] " + colType;
What is wrong in...
I have a connection string (to an SQLServer 2005 database) which specifies a server, username and password, but does not specify an InitialCatalog. When I try and open connection it works, and I can list the tables, which lists a lot of tables, but not the table from the database I am interested in.
What is it I am connected to when ...
OleDbDataAdapter internal error: invalid row set accessor: Ordinal=6 Status=UNSUPPORTEDCONVERSION
All I'm doing is trying to do a simple select statement. The field in ordinal 6 is an NTEXT field. Are they telling me I can't use NTEXT fields in my database with OleDb providers? Is there any workaround here?
...
I've got the following code:
// personCount = 7291; correct value
int personCount = (int)new OleDbCommand("SELECT COUNT(*) AS [count] FROM [Individual]", _access).ExecuteScalar();
List<Person> people = new List<Person>();
OleDbCommand personQuery = new OleDbCommand("SELECT * FROM [Individual]", _access);
using (OleDbDataReader personR...
Hi all
Using a connection string of
"Provider=SQLOLEDB;Data Source=localhost;User ID=foo;password=bar;Database=CodeLists;Pooling=true;Min Pool Size=20;Max Pool Size=30;"
I get the following stack trace
System.Data.OleDb.OleDbException: No
error message available, result code:
-2147024770(0x8007007E). at System.Data.OleDb.O...
I'm having a C++ application connecting to the MS SQL Server 2005 using CDynamicAccessor.
When my column is text or ntext, the CDynamicAccessor::GetColumnType always return DBTYPE_IUNKNOWN. I can bind the data as ISequentialStream and read the byte stream out. However, how can I tell if the column that I'm reading is text or ntext, and h...
C#, .Net 2.0: I have a class that wraps a single record from a database accessed via an OleDbConnection object. It is quite simple, it executes a "SELECT * FROM table WHERE key = {some value};" and then exposes the fields as properties with a few methods to manipulate the data. When I create a new instance of this object, the code tha...
Good afternoon,
I'm having a problem with a section of code I'm working on that checks to see if a dataitem of the same name already exists in a database.
The following code throws up an IndexOutOfRangeException
static int checkExists(String checkIf)
{
String connectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source...
I'm working on an app which is using OLE DB and SQL Server Native Client to access a SQL Server DB. To date, I've only been dealing with fairly simple SQL. For this, I've been obtaining an ICommandText and using SetCommandText. I now want to insert a large object into the database. I see that ICommandStream exists, but it seems like ...
Hello,
In my c# application I am using OLEDB connection string "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\test.xls;Extended Properties=\"Excel 8.0;HDR=NO;ReadOnly=true;IMEX=1\"" to read Excel files.
In order to read a password protected file I tried adding password field in connection string but was unable to read file.
I want to ...
I'm calling a COM library from .NET through a interop assembly and getting the following error:
System.Runtime.InteropServices.COMException(0x80040200): Internal error (ADODB.Connection, -2147467259, Property value is invalid. Make sure the value is typed correctly.)
I have a test and a production version of the same external system. W...
how to install mysql oledb driver in local system.
please give Mysql oledb Connection string
...
Hi,
I am having troubles with one of our applications. It's .NET 3.5 32 bits process. Upon startup we open a .mdb to read a few "metadata" values. This works on hundreds of systems, but we have a customer with a TabletPC and problems. The operating system is Windows XP Tablet PC SP3, 32 bits, bla bla. Nothing unusual. It has .NET 3.5 (f...
Hello,
I am importing data from Excel an spreadsheet. I am only using OLEDB to read. But i am having trouble saving the result back to the original file. Below is my code so far.
string ExcelConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Mode=ReadWrite;" +
"Extended Properties=\"Excel 8.0;HDR=...
I would like get data from Excel files using .NET
The Excel file is being used so I can't open it. What I do is connect to it as a datasource using OleDB.
The problem is that I get a cell's data but not its style. A date value in Excel changes into a datetime format in .NET and a cell set as currency in Excel is showing as an integer i...
I have users that name their sheets all sorts of crazy things, but I want to be able to get the first sheet of the Excel document regardless of what it is named.
I currently use:
OleDbDataAdapter adapter = new OleDbDataAdapter(
"SELECT * FROM [sheetName$]", connString);
How would I go about getting the first sheet no matter what it...
We are trying to connect to a SQL Server instance used by the ACT CRM system. They have managed to lock things down so it isn't possible to connect to the SQL back-end using ODBC (there is some special utility that will add ODBC support that you can install if you purchase the primo version of the software, but that's just crazy).
The ...
Ok, I must be missing something. I can't seem to read a .csv file. Using the following connection string
var fileName = string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, "Uploads\\countrylist.csv");
string connectionString = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}; Extended Properties=""text;HDR=YE...
I am having issues with ADO.NET 2.0 merging/importing data. I need to update/insert data from one generic table to another table with both tables maintaining an identical schema. The following code works great locally, but does not make changes to the database:
OleDbDataAdapter localDA = loadLocalData();
Ol...
I have an Excel file that the customer is pulling from their financial software and uploading to my web app. I need to connect to the file through ADO and read its contents into a SQL database.
The problem is that the file that comes from the financial software is a standalone Excel Worksheet, not Workbook, so no piece of software (b...