After reading this excellent [code snippet](https://www.daniweb.com/software-development/csharp/code/492766/display-excel-data-in-a-datagridview) by djjeavons, and just trying to learn WPF, I decided: "Well, let's translate that to WPF!". It was a bit harder than I thought, but a great learning experience! Her's how my screen in action looks: ![WPFscreen.png](/attachments/small/1/ac05d33ccd8a190d0576fa063e54749f.png "align-left") Things that changed compared to the Forms version: --- OpenFileDialog works a bit different. --- WPF has no `DataGridView` but another beast called `DataGrid` --- Exiting an application has also changed. The communication with Excel still worked seamlessly. I managed to overcome the difficulties and learned alot in doing so. Hope you enjoy to find out …

Member Avatar
Member Avatar
+1 forum 4

Hi, I have been looking for several hours for code that automatically checks if Microsoft acess database engine is installed. If not it reinstalls the database driver by first detecting architechture(32/64 bit). It then automatically installs the driver. I am using Ms Access database 2007 as data source for my app but this just came up after I realized that it won't run on a computer without a Access installed. I figured out the code to detect if the engine is not installed but am not sure if its foolproof. Here is what I thought would be good detecting if …

Member Avatar
Member Avatar
+0 forum 2

Hi, I am new to VB programming. I am using Aceess 2010 database with VB 2010. I have one main table which stores information of company details. The details are broken down in seven different tables with codes to avoid data duplication and keep the main table less bulky. e.g. Company table stores, company code, city code, state code, branch code etc., which can be multiple entries, with other details. The details are stored in respective code tables. e.g. com_code table will store Company Code as Primary Key and the Company Name, city_code table will store city_code as primary key …

Member Avatar
Member Avatar
+0 forum 2

Im having difficulties in making a connection with my database. Can someone help me to resolve my problem. It says "Unrecognized database file format". I am using vb2010 ultimate and ms acess2013. :(

Member Avatar
Member Avatar
+0 forum 1

Hello everyone! I am posting this code for anyone who may be having issues with connecting to a database. Feel free to use this code as you wish. This will be using the OLEDB library. [CODE] 'Imports Imports System.Data.OleDb Public Class Form1 'Declarations Dim con As OleDbConnection Dim cmd As OleDbCommand Dim sqls As String Dim sqlcmd As String Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load 'In form_load event, but can be used on button click. 'For hard coded connection string sqls = "Provider=SQLOLEDB;Datasource=YOURSERVERNAMEHERE;" & _ "Initial Catalog=YOURDATABASENAMEHERE;Integrated Security=SSPI" 'For dynamic connection string sqls = "Provider=SQLOLEDB;Datasource=" & …

Member Avatar
Member Avatar
+2 forum 5

Okay, I'm pulling my hair out. I'm getting NO error on the following code: Dim cmd As New OleDb.OleDbCommand("CREATE TABLE [" + empTableName + "] ([ID] DOUBLE, " & _ "[LnameFname] TEXT(255), " & _ "[Location] TEXT(255), " & _ "[SalaryOld] DOUBLE, " & _ "[FtePercentage] DOUBLE, " & _ "[EvalScore] DOUBLE, " & _ "[EvalUnitsPerm] DOUBLE, " & _ "[EvalUnitsStipend] DOUBLE, " & _ "[EvalIncreasePerm] DOUBLE, " & _ "[EvalIncreaseStipend] DOUBLE, " & _ "[ExperienceDegreeUnits] DOUBLE, " & _ "[ExperienceDegreeIncrease] DOUBLE, " & _ "[AcademicNeedsUnitsPerm] DOUBLE, " & _ "[AcademicNeedsUnitsStipend] DOUBLE, " & _ "[AcademicNeedsIncreasePerm] DOUBLE, " & _ …

Member Avatar
Member Avatar
+0 forum 2

I have the code below in VS 2012. It dynamically allocates a DataGridView and an Update button, then it binds the grid to MS Access database table. That all works well. When I click the Update button btnUpdate_Click() is called, which calls the DataAdapter's Update() method. That produces the syntax error and then displays the sql string for debugging only. Anyone know what I'm missing? ![a37b1576d9a85fb810f68ff57d1ee340](/attachments/large/0/a37b1576d9a85fb810f68ff57d1ee340.png "a37b1576d9a85fb810f68ff57d1ee340") '********************************************************* 'The following are globals at the top of the program '********************************************************* Dim con As New OleDb.OleDbConnection Dim nTries As Integer = 0 Dim binding_source As BindingSource Dim data_table As DataTable Dim data_adapter …

Member Avatar
Member Avatar
+0 forum 10

I have been trying to get my database insert and delete to work for a long time now, and I still cant get it working. I now have just 2 hours left before I absolutely have to have it finished and I can only insert numeric values. I suspect im formatting it wrong? But my delete method also doesn't work, what is wrong with my code? please help, this is becoming incredibly stressful and I need some sleep. Any advice is appreciated! using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; …

Member Avatar
Member Avatar
+0 forum 2

Hi, I seem to be having a problem when attempting to insert a new record into my database through vb.net. From what I can gather, there seems to be an error in the code that the command builder (cBuilder) is creating for me. Here's a copy of the code for the connection: [CODE]Private Sub btnLoadDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadDB.Click Provider = "PROVIDER=MICROSOFT.ACE.OLEDB.12.0;" Source = "Data Source = C:\Documents and Settings\Hp\My Documents\COMP4\COMP4 CW\WND.accdb" connection.ConnectionString = Provider & Source connection.Open() sqlCode = "SELECT * FROM Customers" dAdapter = New OleDb.OleDbDataAdapter(sqlCode, connection) dAdapter.Fill(dSet, "Customers") MsgBox("Database Loaded.", MsgBoxStyle.Information) connection.Close() …

Member Avatar
Member Avatar
+0 forum 7

Dear sir/Madam, In my codes CmdDisplay button display only first record from the table and button2 add the all name (Ename field) to combobox1 from the table. How can i show FirstRecord, PreviousRecord, NextRecord and LastRecord using OleDbCommand and OleDBdataReader. Please guide me. [CODE] Dim cn As OleDbConnection Dim cmd As OleDbCommand Dim dr As OleDbDataReader Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\emp.mdb;") cn.Open() End Sub Private Sub CmdDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdDisplay.Click cmd = New OleDbCommand("select * from table1", cn) dr = cmd.ExecuteReader() If …

Member Avatar
Member Avatar
+0 forum 13

Hi, I have a database (OLEDB) on which i perform operations like insert, delete and update. When i carry out these operations, the changes are reflected in the database during runtime but when i close the form everything goes back to normal. How can i get these modifications to relfect in the datadase even after i close the form. Thank you.

Member Avatar
Member Avatar
+0 forum 5

I am totally new to vb.net, still I am planning to try it for a project, in which there will be standalone machine using an access database to query and update different tables. While in VB6 I was able to define recordsets using Microsoft.jet.oledb.4.0, in VB.net I have become a little confused. I plan to define a global connection to the access database: Dim TheConnection As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0; data source=|DataDirectory|\office.mdb;Persist Security Info=True;Jet OLEDB:Database Password=1234") Depending on what the user has selected, a sql command is created, e.g. Dim SQL_CUSTOMERS As OleDbCommand = New OleDbCommand("SELECT * FROM CUSTOMERS;", TheConnection) …

Member Avatar
Member Avatar
+0 forum 1

Hi guys need help again hope you can help me.. I have a database and i want to Compute all the Total Calls of my 2nd Column I wonder how can i do that? can you give me an example? I'm using Oledb Connection? Thanks in advance.

Member Avatar
Member Avatar
+0 forum 1

Hey Guys, I'm an A level student studdying Computer science, and hence using VB.NET for my coursework. Therefore I'm very novice at VB! While trying to update Data in a Microsoft Office, Access table (Office 2010) - I get this error. (In VB) Bare in mind, I've read all this data from said table already, and that works perfectly. I've tried stepping through my program and also checked the syntax on the SQL String, although all seems to be good! Please, spare a moment to review the code below and see if you can find the problem with it. If …

Member Avatar
Member Avatar
+0 forum 4

I can't seem to wrap my head around this. I'll need a seasoned programmer to push in the right direction. I have a listView with 7 sub items. What I'm looking to do is populate a table in an .mdb file with the data. The listView box is almost the same as the .mdb table I'm attempting to populate. It contains a static number of rows and about 10 columns (some of the columns will be populated with static data others with the dynamic data from the listview. cnn.Open(); //Open database connection foreach (ListViewItem toSenditems in this.listView1.Items) { //insert a …

Member Avatar
Member Avatar
+0 forum 1

Hello all I am writing a solicitor allocation application that will be used by multiple users at one time. Because of this, the database needs to be updated with every change. This is my code when a solicitor is chosen for allocation: private void FindSolicitor(int type, bool stype) { table = ""; row = 0; int t = 0; bool f = false; string s = ""; char ctype = char.Parse(type.ToString()); if (!stype) { t = 0; for (int i = 0; i < sadset.Tables["Solic"].Rows.Count; i++) { if (sadset.Tables["Solic"].Rows[i]["State"].ToString() == "0" && ((sadset.Tables["Solic"].Rows[i]["Types"].ToString()).Contains(ctype))) { f = true; sadset.Tables["Solic"].Rows[i]["State"] = 1; …

Member Avatar
Member Avatar
+0 forum 1

hey, i need to insert a row into datagridview meanwhile it has to be updated in the database(backend) using oledb. thanks inadvance

Member Avatar
Member Avatar
+0 forum 1

Hi, I've written a routine for a customer to import sales orders into their Sage system. Everything was going well but the client has come back with a particular excel sheet that is not importing. He is getting a message to tell him the sheet is not in a valid format which comes from the results of a validation function I have in my routine. I have looked at the Excel workbook and there is only one sheet. The sheet only has two rows, one for the column headers (all there,) and a second containing a single order. I debugged …

Member Avatar
Member Avatar
+0 forum 1

Hoi At the moment I'm learing Databases. this is some code that I'm using. The question that I have is, can I insert a row without ID. I mean that the database increase the ID number itself. Thanks in advance. command = new OleDbCommand(); command.Connection = connect; command.CommandText = "INSERT INTO Calendar (ID, Datum, Titel, Opmerking) VALUES (@ParaID, @ParaDatum, @ParaTitel, @Opmerking)"; command.Parameters.AddWithValue("@ParaID","ID" ); command.Parameters.AddWithValue("@ParaDatum", Calendar1.SelectedDate.Date.ToShortDateString()); command.Parameters.AddWithValue("@ParaTitel", "dit is een test"); command.Parameters.AddWithValue("@Opmerking", "dit is ook een test");

Member Avatar
Member Avatar
+0 forum 2

Dear Daniweb members. I am having quite a troublesome time here with OleDb. What I am trying to achieve is to allow my users to connect to an uploaded Excel workbook, then to be able to select data from the sheets. I have a query designer in the front end that allows them to generate the query based on what they are selectting. The outcome query would look like this : (example) : `SELECT [A].[Date] AS 'Date' , [A].[Unique ID #] AS 'Unique ID #' , [A].[Case ID #] AS 'Case ID #' , [A].[ID number] AS 'ID number' , …

Member Avatar
+0 forum 0

I am currently creating a product lookup system for a project of mine, however from reading around it has come to my attention that an OLEDB connection will not handle the SQL query below as it will not handle more than a simple "SELECT, FROM". Table: tbl_ProductInformation Field: Product_Name CurrentEntry = Variable storing the users entry [CODE] "SELECT Product_Name FROM tbl_ProductInformation WHERE Product_Name LIKE '*" & CurrentEntry & "*'" [/CODE] The outcome of this query is then put into a listbox. Is there anyway to make the OLEDB SQL query work so that the returned entries will correctly narrow down …

Member Avatar
Member Avatar
+0 forum 14

Imports System.Data.SqlClient Imports System Imports System.Data Imports System.Collections Imports System.Windows.Forms Imports System.Resources Imports System.Data.OleDb Imports System.Drawing Imports System.Net.Mail Imports System.Configuration Imports System.Web Imports System.Web.Security Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.WebControls.WebParts Imports System.Web.UI.HtmlControls Public Class Form1 Inherits System.Windows.Forms.Form Dim counter As Int32 = 0 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load txtDate.Text = DateTime.Now.ToString("MM/dd/yyyy") Me.DataGridView1.EnableHeadersVisualStyles = False With DataGridView1.ColumnHeadersDefaultCellStyle .Alignment = DataGridViewContentAlignment.MiddleCenter .BackColor = Color.Maroon .ForeColor = Color.WhiteSmoke .Font = New Font(.Font.FontFamily, .Font.Size, _ .Font.Style Or FontStyle.Bold, GraphicsUnit.Point) End With With Me.DataGridView1 .RowsDefaultCellStyle.BackColor = Color.Cornsilk .AlternatingRowsDefaultCellStyle.BackColor = Color.AliceBlue End With DataGridView1.AllowUserToAddRows = False End Sub Private …

Member Avatar
Member Avatar
+0 forum 4

In C# ... How can i search my access database by some column(other than the primary key).. for example if i want user to search entries by Entring last name in a textbox .. and this could have more than one entry and show the results in the grid view table ...???

Member Avatar
Member Avatar
+0 forum 1

I asked this basic question a couple of days ago but I probably didn't include enough information in my question. Sorry for reposting, but I am really lost here. This is a web application in VB.net connecting to an Access database on a 2003 server. The problem: I have a asp.net web page using vb.net that connects to an access database. When I run a query from the web page, it seems to run properly. Ie: The entered information in inserted to the proper table and the "Results" view in the database is populated with the correct data. When it …

Member Avatar
Member Avatar
+0 forum 1

Hello Friends. Im having a problem in identifying the Provider for my MSSQL Server 2008. Can anyone address me the location of this information because I have to initialize it in my VB.et. As I understand for Ms Access it is something like [CODE]"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="[/CODE] Can I know where to find for MSSQL Server 2008. Please. Badly Need it. Thanks a bunch

Member Avatar
Member Avatar
+0 forum 1

Hi, I have this program that uses OLEDB connection to import excel file to data table then use it in other functions. Now I have this question: What are the possible limitations of OLEDB when it reads the Excel file. The File is on xls format, and I want to know if there is such limitations (for example: It has limitation in reading value on a cell). Thanks

Member Avatar
Member Avatar
+0 forum 6

Hi, I have this program that uses OLEDB connection to open the excel file, and imports it's data. Then I use mysql connection to inserts all this data. Now my question is, is it possible that I can use mysql connection in opening the excel file, or only OLEDB connection is the most possible way to open it? Thanks..

Member Avatar
Member Avatar
+0 forum 2

Hi Looking for some general advice: I have taken over support of a large and complex web site, which uses multiple Access databases. At present it makes use of the MS Jet database engine (Provider=Microsoft.Jet.OLEDB.4.0). (as well as MySQL, used in a Snitz forum). After solving many specific problems I am left with a nasty situation, where certain database calls appear to cause the Jet engine to freeze, and everything halts until pages time out and the blockage is cleared. After such a timeout everything runs nicely until the next incident. These incidents are random. There is some evidence that …

Member Avatar
Member Avatar
+0 forum 3

Hello! i wanna to create a game that will use a mdb database file to store things and upload them while the gema will need them the thing is i dont want that the player could touch the file and easily cnange things with access.. there is a way to prevent the players to look or change stuff inside the mdb file? thanks! :)

Member Avatar
Member Avatar
+0 forum 3

Hello, im working on a project that works with an access database but i dont know how to edit an existing record... here is the code that i use for reading the database: [CODE]Public Function ask() Dim dt As New DataTable Dim ds As New DataSet ds.Tables.Add(dt) con.Open() Dim da As New OleDbDataAdapter("select * from data", con) da.Fill(dt) Dim newRow As DataRow = dt.NewRow For Each DataRow In dt.Rows If CardID.Text = DataRow.Item(0) Then usrname = DataRow.Item(1) cardv = DataRow.Item(0) usrid = DataRow.Item(2) log2.DataSource = dt.DefaultView DataRow.Item("card") = cardv 'dt.Rows.Add(newRow) Dim cb As New OleDbCommandBuilder(da) log.DataSource = dt.DefaultView da.Update(dt) Return …

Member Avatar
Member Avatar
+0 forum 3

The End.