string location = Environment.CurrentDirectory;
            string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" + location + "\\harita.accdb";
            // get records from the Shippers table
            string commandString = "Select x from map";


            //create the data set command object and the DataSet
            OleDbDataAdapter DataAdapter = new OleDbDataAdapter(commandString, connectionString);

            DataSet ds = new DataSet();
            // fill the data set object
            DataAdapter.Fill(ds, "map");
            // Get the one table from the DataSet
            DataTable dataTable = ds.Tables[0];
            // for each row in the table, display the info
            foreach (DataRow dataRow in dataTable.Rows)
            {
                // listBox1.Items.Add(dataRow["x"]);
                tb.Text = Convert.ToString(dataRow["x"]);
                tbb.Text = Convert.ToString(dataRow["y"]);


                #region Draw Icon
                if (drawicon)
                {
                    double lon = Convert.ToDouble(tb.Text);
                    tb.Text = Convert.ToString(dataRow["x"]);

                    double lat = Convert.ToDouble(tbb.Text);



                    e.Graphics.DrawImage((Image)(harita1.Properties.Resources.icon), new Rectangle((int)(lon), (int)(lat), 23, 23));


                }


                #endregion

            }
This article has been dead for over six months. Start a new discussion instead.