Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7836981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:25:11+00:00 2026-06-02T14:25:11+00:00

I have 2 dataGridViews on a form, and when I run the app, nothing

  • 0

I have 2 dataGridViews on a form, and when I run the app, nothing shows up. I believe that adding the dataGridView information in the code, like below, I don’t need to add the database using Visual Studio’s “Server Explorer”. That would be redundant and/or change the fill outcome of the dataGridView, right? Am I missing something in my code??

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 WindowsFormsApplication1
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
      DataSet ds = new DataSet();
      OleDbDataAdapter daOrders = new OleDbDataAdapter();
      OleDbDataAdapter daReceived = new OleDbDataAdapter();
      OleDbConnection vcon = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;data source=C:\Query Form\Database.accdb");    

      OleDbCommand slctOrders = new OleDbCommand("SELECT * FROM script_Orders ORDER BY script");
      daOrders.SelectCommand = slctOrders;
      daOrders.Fill(ds, "tblOrders");

      OleDbCommand slctReceived = new OleDbCommand("SELECT * FROM script_Received");
      daOrders.SelectCommand = slctReceived;
      daOrders.Fill(ds, "tblReceived");

      dgOrders.DataSource = ds.Tables ["tblOrders"];
      dgReceived.DataSource = ds.Tables ["tblReceived"];
    }
  }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T14:25:16+00:00Added an answer on June 2, 2026 at 2:25 pm

    Try passing the connection into the data adapter…

    OleDbCommand slctOrders = new OleDbCommand("SELECT * FROM script_Orders ORDER BY script", vcon);
    

    I’m not sure if that is all you are missing (you might also need to open the connection, vcon.Open()), but there has to be some some link between the connection object and the adapters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have datagridviews on windows form, i am adding records to datagridview using small
I have a windows form that has two DataGridViews (DGVs) that will hold 25,000+
I have a form that contains dataGridView, whose coloumn are set to dgrv1.Width =dgrv1.Columns.GetColumnsWidth(DataGridViewElementStates.Visible)+20;
I have a Windows Form that displays several DataGridViews in the following layout: (No
I have a DataGridView in a C# WinForms app that is DataBound at runtime
I have a DataGridView control in a winforms app that I'm working on. The
I have a DataGridView form in my .NET application and I'd like to be
I have a DataGridView in a form that has a data table as the
I have a datagridview on a form that is bound to a table in
I'm working on a WindowsForm project and in my form I have a DataGridView

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.