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.Data.OleDb;
namespace MyTry
{
public partial class Form1 : Form
{
BindingSource tblNameBs = new BindingSource();
public Form1()
{
InitializeComponent();
}
private void btnImport_Click(object sender, EventArgs e)
{
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\Cp\My Documents\MyExample.xlsm" + @";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1;ImpoertMixedTypes=Text;TypeGuessRows=0""";
string comm = "Select VodicBase.FazaVodica,VodicBase.VisinaVodica,VodicBase.RazmaciVodicaOdstupa,Vodicprop.RadijusVodica,VodicProp.SpecificniElektricniOtporVodica,VodicPropUnutrasnjiOtpor FROM VodicBase,VodicProp";
OleDbCommand command = new OleDbCommand(comm, conn);
DataSet dsDvds = new DataSet();
OleDbDataAdapter adapter = new OleDbDataAdapter(command);
OleDbCommandBuilder Builder = new OleDbCommandBuilder(adapter);
adapter.Fill(dsDvds);
dtgViewTab.DataSource = dsDvds.Tables[0];
tblNameBs.DataSource = dsDvds.Tables[0];
}
}
}
VodicBase i VodicProp su mi dvi tablice u istom sheetu
Gresku javlja ovdje -->"adapter.Fill(dsDvds);"
--The Microsoft Office Access database engine could not find the object 'VodicBase'. Make sure the object exists and that you spell its name and the path name correctly.
Jeli zna netko kako da rijesim stvar,gledo sam po netu ima nesto o ovome tipu problema ali nisam shvatio.