oledb

What's wrong with these parameters?

假装没事ソ 提交于 2019-11-26 08:37:52
问题 I have an Access file with 7 fields: DocID - text - primary SourceID - text ReceivedDay - Date/Time Summary - text DueDay - Date/Time Person - text Status - Yes/No Now I want to update this file with the following code: const string ConnectionString = \"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\\\DocMan.mdb;Persist Security Info=True\"; const string InsertQuery = \"INSERT Into Docs(DocID,ReceivedDay,Summary,Person,DueDay,Status,SourceID) Values(@DocID,@ReceivedDay,@Summary

How to connect to a MS Access file (mdb) using C#?

心已入冬 提交于 2019-11-26 07:45:29
问题 I\'m trying to connect to a mdb file and I understand that I would need Microsoft.OLEDB.JET.4.0 data provider. Unfortunately, I do not have it installed on the (University) machine. Since, they don\'t provide that provider, I believe there should be a way around. How can I connect to the file without Microsoft.OLEDB.JET.4.0 or is there any alternative ? I have following providers: I have tried using OLE DB Provider for Microsoft Directory Services , to which while testing connection, I get \

OleDbParameters and Parameter Names

隐身守侯 提交于 2019-11-26 06:47:45
问题 I have an SQL statement that I\'m executing through OleDb, the statement is something like this: INSERT INTO mytable (name, dept) VALUES (@name, @dept); I\'m adding parameters to the OleDbCommand like this: OleDbCommand Command = new OleDbCommand(); Command.Connection = Connection; OleDbParameter Parameter1 = new OleDbParameter(); Parameter1.OleDbType = OleDbType.VarChar; Parameter1.ParamterName = \"@name\"; Parameter1.Value = \"Bob\"; OleDbParameter Parameter2 = new OleDbParameter();

What is IMEX within OLEDB connection strings?

雨燕双飞 提交于 2019-11-26 06:41:18
问题 \"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=localhost;Extended Properties=\"\"Excel 8.0;HDR=Yes;IMEX=2\" What is the purpose of IMEX=2 in the above connection string? 回答1: From ConnectionStrings "If you want to read the column headers into the result set (using HDR=NO even though there is a header) and the column data is numeric, use IMEX=1 to avoid crash. To always use IMEX=1 is a safer way to retrieve data for mixed data columns. .." Please note that the IMEX value can be very important

OleDbCommand parameters order and priority

☆樱花仙子☆ 提交于 2019-11-26 05:29:01
I have been debugging this query for the last 40 minutes, and the problem apparently is the order of the parameters after all. SELECT * FROM tblSomeThing WHERE id = @id AND debut = @dtDebut AND fin = @dtFin Then I add the parameters this way, notice that the two last parameters are switched, I get no results. cmd.Parameters.Add("@id", OleDbType.Integer).Value = idSociete; cmd.Parameters.Add("@dtFin", OleDbType.Date).Value = dateTraitementFin; cmd.Parameters.Add("@dtDebut", OleDbType.Date).Value = dateTraitementDebut; When I declare the parameters the way they appear in the queury everything

Parsing CSV using OleDb using C#

主宰稳场 提交于 2019-11-26 04:49:12
问题 I know this topic is done to death but I am at wits end. I need to parse a csv. It\'s a pretty average CSV and the parsing logic has been written using OleDB by another developer who swore that it work before he went on vacation :) CSV sample: Dispatch Date,Master Tape,Master Time Code,Material ID,Channel,Title,Version,Duration,Language,Producer,Edit Date,Packaging,1 st TX,Last TX,Usage,S&P Rating,Comments,Replace,Event TX Date,Alternate Title ,a,b,c,d,e,f,g,h,,i,,j,k,,l,m,,n, The problem I

what is the difference between OLE DB and ODBC data sources?

前提是你 提交于 2019-11-26 04:29:49
问题 I was reading a MS Excel help article about pivotcache and wonder what they mean by OLE DB and ODBC sources ...You should use the CommandText property instead of the SQL property, which now exists primarily for compatibility with earlier versions of Microsoft Excel. If you use both properties, the CommandText property’s value takes precedence. For OLE DB sources , the CommandType property describes the value of the CommandText property. For ODBC sources , the CommandText property functions

Searching values via a datagridview

旧街凉风 提交于 2019-11-26 04:28:58
问题 i am try to search for a specific value in a database by entering text into a textbox and then using SQL to query the database and then display results in the datagridview. here is the code: Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSearch.TextChanged Connection.Open() Dim dataTable As New DataTable Dim dataSet As New DataSet dataSet.Tables.Add(dataTable) Dim dataAdapter As New OleDbDataAdapter Dim SQLQuery As String SQLQuery =

Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine

假如想象 提交于 2019-11-26 02:05:46
问题 I created a windows application developed in .NET 3.5 in a 32 bit Windows 2008 server. When deployed the application in a 64 bit server it shows the error \"Microsoft.Jet.OLEDB.4.0\' provider is not registered on the local machine \". So as a solution to this issue, i have changed the build property of the project to X86, so that it will build in 32 bit mode, and rebuild the project in the 32bit machine. But, the same project uses other DB drivers (DB2, SQL etc.) to connect to other databases

how to update a table using oledb parameters?

蓝咒 提交于 2019-11-26 02:02:49
问题 I am having a table which has three fields, namely LM_code,M_Name,Desc. LC_code is a autogenerated string Id, keeping this i am updating M_Name and Desc. I used normal update command, the value is passing in runtime but the fields are not getting updated. I hope using oledb parameters the fields can be updated. Here is my code. public void Modify() { String query = \"Update Master_Accounts set (M_Name=\'\" + M_Name + \"\',Desc=\'\" + Desc + \"\') where LM_code=\'\" + LM_code + \"\'\";