oledb

No value given for one or more required parameters When all parameters are given

不问归期 提交于 2019-12-12 05:14:41
问题 The Error i get is An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll Additional information: No value given for one or more required parameters. but this is when all parameters a present code bellow: private OleDbDataReader dbReader;// Data Reader object string sConnection = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=ICTSchool.accdb"; string sql; OleDbConnection dbConn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source

Efficient way to bulk insert into Dbase IV (.dbf) files

半城伤御伤魂 提交于 2019-12-12 04:54:01
问题 My question is pretty much the exact same as Efficient way to bulk insert into Dbase (.dbf) files - Is there an efficient way to bulk insert into dbase IV dbf files? The source data is coming from SQL Server 2012. I have Visual FoxPro available but I'd like to do this programatically from C#. 回答1: As mentioned in comment, if in VFP, you should be able to do quite easily by means of nHandle = sqlconnect( "connection string to your database" ) sqlexec( nHandle, "select * from YourTable",

OLEDB - select Count not working

筅森魡賤 提交于 2019-12-12 04:42:44
问题 Find below what I've done so far, but unfortunately it's not working. Private BS as New BindingSource Dim ds As New DataSet ' Make the Connection Using con As New OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = Database1.mdb") con.Open() Dim Sql = "SELECT COUNT ([Eventname]) FROM Eventproposal" Dim da = New OleDb.OleDbDataAdapter(Sql, con) da.Fill(ds, "Eventproposal") ' Set the Binding Source bs.DataSource = ds.Tables("Eventproposal") con.Close() End Using TextBox1

How to remove duplicate records from excel sheet using oledb

允我心安 提交于 2019-12-12 04:14:17
问题 I have an excel sheet with 4 column(JobCode,JobName,StartDate,EndDate). On the basis of one rule I have to validate the 1st excel sheet and insert all the record in 2nd excel sheet except the duplicate record which is present in 1st excel sheet. I tried to using list. But it's working as expected. List<string> JobCodeList = new List<string>(); for (int iRowCount = 0; iRowCount < hrms_jobdata.Tables[0].Rows.Count; iRowCount++) { JobCode = hrms_jobdata.Tables[0].Rows[iRowCount]["Job Code"]

Export access query to excel in console application

不问归期 提交于 2019-12-12 04:13:47
问题 I have a query being created using OLEDB from access and need to get the information to an already existing excel spread sheet. I am using VS 2010 with VB.Net, MS Access and Excel are 2010. I have been running in circles for the last two days and cannot figure out, how to get the data from a DataReader into excel? This is a VB.Net console application, so no web tables or grids can be used. Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Pureshow\Pureshow

C# ace oledb 12 read-only file

左心房为你撑大大i 提交于 2019-12-12 04:12:48
问题 I have a SSIS package with script task. c# script use ACE Oledb 12.0 provider to connect to excel file. The question is, how to connect to excel file in read-only mode (if someone open the file, my script should not have an error - it should work). The code, I tried here: string fileToTest = Dts.Variables["User::FileName"].Value.ToString(); string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + fileToTest + @";Extended Properties=""Excel 8.0;READONLY=1""";

using a variable in oledb command

两盒软妹~` 提交于 2019-12-12 03:54:56
问题 What is the correct way to concatenate a variable when using the oledb command function in c# for a sql query. To apply some context im trying to make what a list box displays dependent on another selection made on a previous list box.This is what I've tried but doesn't work. OleDbCommand projects = new OleDbCommand("SELECT * FROM Client_projects WHERE clients = " + (listBox1.SelectedItem.ToString()) , conn); OleDbDataReader project = projects.ExecuteReader(); while (project.Read()) { // Add

Cannot import data from excel 2003 to database using openrowset function

核能气质少年 提交于 2019-12-12 03:16:15
问题 This is my laptop spec : OS : Windows 7 - 64bit , Database : SQL SERVER 2008 R2 , Microsoft Office : Microsoft Office 2007, My problem is : When I run my procedure to import data from excel 2003 (xls) to database (SQL Server 2008) , I've got this error : <span style="color:red">OLE DB provider 'Microsoft.Jet.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode.</span> this is my procedure : SELECT * FROM OPENROWSET(

Update database from datagridview

蹲街弑〆低调 提交于 2019-12-12 03:10:08
问题 I have googled a lot on updating datagridview to database after editing using the adapter. I referred to several websites that gave me similar examples like the one below. However, I'm getting the "ArgumentNullException was unhandled" error at the first line of my button2_Click. I am new to programming and I have been taught to declare the adapter as a global, and I did. Why am I still getting null value? Any help would be appreciated. Thank you! DataTable dt; DataSet ds; OleDbDataAdapter

Storing fields from a database in an array c#

喜夏-厌秋 提交于 2019-12-12 03:07:46
问题 I am trying to store all fields from a column in my microsoft access database in an array. I am using OleDb but I don't really know how to go about doing this. I know that I have to have a loop to go over the table the amount of times as there are rows in the table, but I don't know how to store the current field in the current index of the array. Any help would be greatly appreciated! Here is a snippet of some of the code: string[] tasks; string sql = "SELECT [Task Name] FROM Tasks";