Menu
  • HOME
  • TAGS

Creating OleDBConnection

c#,visual-studio-2013,oledbconnection,oledbcommand

I don't think that syntax should work in any version of Visual Studio tbh. FWIW, I think you want to use the using statement: public static string DCAVACA(string badTable) { using (var olecon = new OleDbConnection(OLECONN)) // only change required for *syntactic* reasons { olecon.Open(); deleteTable = new string[1] {...

INSERT into Access DB using Windows Forms not working but not throwing an error

c#,winforms,datetime,ms-access,oledbcommand

You are mixing 2 different ways of doing database access. One one hand you are working with an adapter which is intended with working with a dataset. You would do the changes on a table in a dataset and then call update on the adapter. But you are taking control...

Using “… where Column like …” in OleDbCommand not working

c#,sql,visual-studio,ms-access,oledbcommand

With OleDb, you definitely need % instead of * as the wild card. I don't know .Net, but I'm guessing this will work ... OleDbCommand command = new OleDbCommand("Select * from Lid Where Naam Like '%' & @naam & '%' order by RangID desc, Creatiedatum, Naam", connection); command.Parameters.Add(new OleDbParameter("@naam", naam));...

MS Access OleDB does not return any row

c#,oledbcommand

You need to read from your datareader into an object, before you close the connection. Like: List<object> x = new List<>(); while (dr.Read()) { x.Add(<your stuff>); // add as appropriate } then return the List (or whatever you use) instead of returning the datareader...

Oledbconnection

c#,sql,dataset,oledbconnection,oledbcommand

Not entirely sure what you want to do but maybe public void AddToDatabase(string strAccessSelect) { try { myAccess.Open(); OleDbCommand OleDbUpdateCommand = new OleDbCommand(strAccessSelect, myAccess); OleDbUpdateCommand.ExecuteNonQuery(); } catch (Exception ex) { error = "Couldn't fetch the required data. " + ex.Message; } finally { myAccessConn.Close(); } } ...

Insert Value below merged column cells

c#,excel,oledbcommand

By default it will enter the data into the first cell when you have merged cells. Move "Person" to the first row and add HDR=YES;. OleDbCommand cmd1 = new OleDbCommand("Update [Sheet1$] "+ "set [Oct-14] = ‘Value ’ where [Person]='John', cn); For the date if there are issues just using Oct-14...

How to add BLOB column in database?

c#,image,blob,oledbcommand,oledbexception

Try using ALTER TABLE item ADD picture LONGBINARY...

SSIS Execiption: “Could not find stored procedure '##########'…”

sql-server,stored-procedures,ssis,oledbcommand

Check to make sure that the OLE DB connection is set to the fully qualified path to the DB in which the storedProcedure is stored or if is not set to fully qualified path, the [db name].dbo.[storedProcedure]

OleDbCommand, WHERE

c#,oledbcommand

You are missing = sign. command.CommandText = "SELECT CompanyName FROM CustomersTable WHERE CompanyName = @p1"; ...

Syntax error in INSERT statement into MS Access

c#,ms-access,oledb,oledbcommand

Seems like Password is a reserved keyword in OLE DB Provider. Use it with square brackets like [Password]. But as a best practise, change it to non-reserved word. And OleDbCommand doesn't support named parameters. From documentation; The OLE DB .NET Provider does not support named parameters for passing parameters to...

Issue in updating MS Access records using oledbcommand.executeNonQuery(), result not updating

c#,ms-access-2007,oledb,oledbcommand

OleDbCommand doesn't support named parameters. The only matter is their orders. From OleDbCommand.Parameters property The OLE DB .NET Provider does not support named parameters for passing parameters... Therefore, the order in which OleDbParameter objects are added to the OleDbParameterCollection must directly correspond to the position of the question mark placeholder...

How to compose proper insert/update/delete commands to update linked tables in source access database?

c#,database,oledb,ole,oledbcommand

This idea is probably mistake. Better to look for some alternative for MS Access.

Saving Image into memory stream Error

vb.net,gdi+,memorystream,oledbcommand

Per the documentation for Image.FromStream, the stream must be kept open for the lifetime of the Image, but you are disposing of the stream in this line: If MStream IsNot Nothing Then MStream.Dispose() Try removing that line from your first code block. I suppose the MemoryStream should be disposed of...

How can I select multi-column from table where date is last day?

c#,xcode,ms-access,oledb,oledbcommand

You are converting a DateTime to string and then parse it back to DateTime in the next line, this doesn't make sense. I think you should use parameters, see if this works, I don't use MySql: connect.Open(); command.Connection = connect; todday = DateTime.Today.ToString("dd/MM/yyyy"); string query = "select attendance as [Attend],...

Specified cast is not valid. SQL Parameter

c#,asp.net,sql,datareader,oledbcommand

The thing is if I replace @Reg with text 'WM07 OGR' it works fine. However the string reg returns this so why the error? It seems that you get the error if the query returns null because there is no matching TX_VEHNUMBER, then the cast to int fails. So...

How to set Access column value to 0 (default) on a new created DB column? C#

c#,database,oledbcommand,oledbdatareader

Your problem is related to the fact that after adding the new column, the old records are not updated with the default value. They contains a NULL. You need to add an UPDATE query to your creation routine that sets the DEFAULT for all existing records string query = "ALTER...

hebrew from the Connection

c#,oledb,sqlplus,oledbconnection,oledbcommand

I can't really test this because I don't know anything about your database (not even your column names), but you should do that command with parameters: var testString = "היי"; // Do be aware that Visual Studio displays Hebrew text right-to-left, so the actual string is reversed from what you...

OleDbCommand, two sequential “using”

c#,oledbconnection,oledbcommand

There's only one connection there - and a command using the same connection. Both will be disposed. This is effectively: using(OleDbConnection con = new OleDbConnection(conString)) { using(OleDbCommand command = con.CreateCommand()) { } // command will be disposed here } // con will be disposed here ...

Display hebrew language sqlplus

c#,oledb,sqlplus,oledbconnection,oledbcommand

Your database character set has to support unicode characters in order to be able to store non-ascii characters. This setting is defined by the DBA when creating the database which means your DBA most likely needs to recreate the database from scratch. This is not an easy option if the...

How to change data type of a column in DataTable

c#,sql-server,datatable,oledb,oledbcommand

// Create a temporary table DataTable dtNew = new DataTable(); for(int i=0;dt.Columns.Count;i++) { dtNew.Columns.Add(dt.Columns[i].ColumnName,typeof(string)); } // Add data to new table for(int i=0;dt.Rows.Count;i++) { dtNew.Rows.Add(); for(int j=0;dt.Columns.Count;j++) { dtNew.Rows[i][j] = dt.Rows[i][j]; } } dt=null; dt=dtNew.Copy(); ...

Insert into Database using OleDbConnection

asp.net,vb.net,insert,sql-update,oledbcommand

For some reason INSERT SQL was giving me constant issues so I decided to go for a stored procedure instead. With my stored procedure inside Oracle, the following is my VB.net code: Dim ClassifiedStr As New OleDbCommand ClassifiedStr.CommandType = CommandType.StoredProcedure ClassifiedStr.CommandText = "Insert_classifieds" ClassifiedStr.Connection = conn 'Must be organized based...

Trying to delete a record from my access database in visual basic studio 2010

vb.net,visual-studio-2010,oledbcommand,oledbdataadapter

Notes: 1)Never leave your OleDbConnection Open. Only allow it to be opened when you actually need it. This will save you from a lot of headaches later on. The reasons why can be found on following stackoverflow question. 2) There is no reason to return an OleDbDataAdapter if you don't...

Nested SELECT throws an exception “No value given for one or more required parameters”

sql,oledb,oledbconnection,oledbcommand,oledbexception

You have a couple problems. One, you haven't selected the CustomerID field in your subquery so you can't filter on it from the outer query. Second, you are referencing the wrong table alias in the outer query. Try this instead: SELECT * FROM (SELECT [Orders].[OrderDate], [Orders].[CustomerID] FROM [Orders]) t WHERE...

OleDbCommand, WHERE don't care

c#,oledbcommand

Because "Zap" is not equal to "Za" You nee to use Like operator something like this:- command.CommandText = "SELECT CustomerID, CompanyName FROM CustomersTable WHERE CompanyName LIKE @p1"; command.Parameters.Add("@p1", OleDbType.VarChar).Value = "%Za%"; ...

OleDbCommand, No value given

c#,oledbcommand

I strongly suspect since you used qqq and xyz without single quotes, OleDbCommand see them as a parameter. That's why it expects some parameter values for both. Because if they were strings, they would be used with single quotes like; INSERT INTO Customers (CustomerID, CompanyName) VALUES ('qqq', 'xyz') If they...