how to convert from 'string' to 'System.Data.DataTable'
I Have this code and my computer appear kode error
I have put all the web site on the attach
The best overloaded method match for 'System.Data.OleDb.OleDbDataAdapter.Fill(System.Data.DataTable, object)' has some invalid arguments
cannot convert from 'string' to 'System.Data.DataTable'

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

public partial class ContentPage : System.Web.UI.Page
{
    
    public OleDbConnection odc;
    public DataSet ds;
    public OleDbDataAdapter oda;
    public DataTable dt;
    string s;
    protected void Page_Load(object sender, EventArgs e)
    {
        //Label1.Text = "";
        helloUser();
        Label1.Text = s;
        Label2.Text =  DateTime.Now.ToLongDateString();
    }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        Response.Redirect("Vetura.aspx");
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        Response.Redirect("ChangePassword.aspx");
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {


        if (DropDownList1.SelectedItem.ToString()== "Audi")
        {
            Panel15.Visible = true;
            Panel14.Visible = false;
            Panel1.Visible = false;
        }
        else
        {
            if (DropDownList1.SelectedItem.ToString() == "Mercedes")
            {
                Panel14.Visible = true;
                Panel1.Visible = false;
                Panel15.Visible = false;
            }
            else {
                if (DropDownList1.SelectedItem.ToString() == "BMW")
                {
                    Panel1.Visible = true;
                    Panel14.Visible = false;
                    Panel15.Visible = false;

                }
                 }
        }

        
        //ImageButton14.ImageUrl = "D:\\Viti-III Sh.Komp\\RRjeta Komp & Prog WWW\\AutoVetura\\Picture\\zconcept1.jpg";
       /*     OleDbDataReader objReader = null;
        ds = new DataSet();
        string ConnString;
        ConnString = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " + ("C:\\AutoBase.mdb");
        odc = new OleDbConnection(ConnString);

        OleDbCommand objComm = new OleDbCommand("ProcN");
        objComm.CommandType = CommandType.StoredProcedure;
        OleDbParameter objParam = new OleDbParameter();
        objParam = objComm.Parameters.Add("@Marka", OleDbType.Char);
        objParam.Direction = ParameterDirection.Input;
        objParam.Value = DropDownList1.SelectedItem.ToString();
        try
        {
            odc.Open();
            objReader = objComm.ExecuteReader();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message.ToString());

        }
        */
        

    }
    public void helloUser()
    {
        OleDbDataReader objReader = null;
        string ConnString;
        ds = new DataSet();
        //ds1 = new DataSet();
        ConnString = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " + ("C:\\db1.mdb");
        odc = new OleDbConnection(ConnString);
        oda = new OleDbDataAdapter(" SELECT Username FROM Tab3", odc);
        oda.Fill("Tab3",ds);
        s = ds.Tables["Tab3"].Rows[0][0].ToString();
    }
    protected void ImageButton14_Click(object sender, ImageClickEventArgs e)
    {
        if (DropDownList2.SelectedItem.ToString() == "Porche")
        {
            Panel16.Visible = true;
            Panel17.Visible = false;
            Panel18.Visible = false;
        }
        else
        {
            if (DropDownList2.SelectedItem.ToString() == "Golf")
            {
                Panel17.Visible = true;
                Panel16.Visible = false;
                Panel18.Visible = false;
            }
            else 
            {
                if (DropDownList2.SelectedItem.ToString() == "BMW")
                {
                    Panel18.Visible = true;
                    Panel17.Visible = false;
                    Panel16.Visible = false;
                }
            }
        }
    }
    protected void LinkButton3_Click(object sender, EventArgs e)
    {
        Response.Redirect("Vetura.aspx");
    }
}

1) Please use code tags!
2) See below.

oda.Fill("Tab3",ds); // <--- wrong order. DataSet first, string second.

thanks it was wery helpfull

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.