473,379 Members | 1,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Fill: SelectCommand.Connection property has not been initialized

hello,i'm new to vb.net,and i'm trying to do my first program for my training...my program is about the Northwind2 database in sql server,i have a "ShowAll" button,that displays in a form the "Customers" table..i know how to do it using drag and drop datagridview,but i have to write a code by myself to fill it..that's what i wrote and when i push the button i have this error message
"Fill: SelectCommand.Connection property has not been initialized" on this line
"da.Fill(ds, "Customers")"...plz help me quickly,i have to complete the program in 2 days:(...

Private Sub btnShowAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowAll.Click
//// "this part i wrote it in the class (MainForm) and the form(All) inherits it"
Dim ds As New DataSet
Dim da As New SqlClient.SqlDataAdapter(sql = "SELECT * FROM Customers", con)
Dim sql As String
Dim con As New SqlConnection()//////
All.btnShowAll.Enabled = False
All.Show()
con.Open()
All.DataGridView1.DataSource = ds.DefaultViewManager
sql = "SELECT * FROM Customers"
con.Close()
da.Fill(ds, "Customers")
All.DataGridView1.DataSource = ds.DefaultViewManager
End Sub


thank you:)...
Nov 5 '08 #1
0 5331

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Auto | last post by:
I starting to use Visual Studio .NET 2003 creating C# Windows application with SQL Server and I get problem with method Fill() for which when running ends with System Error even with the most...
5
by: Helixpoint | last post by:
Here is my code: Dim availMach As New ASPNETProduct.machinedb() Dim dstMachList As DataSet dstMachList = availMach.GetAvailMach(theSearchVal, theSearchBy, theMachCode1, theSearchView,...
0
by: TJS | last post by:
attempting to read a delimited text file into a dataset using oledb text file connection getting this error message when trying to open connection...
6
by: JeffB | last post by:
I have tried several different methods of getting a datagrid to fill with information. Below is the code I'm now using. When viewed in the browser and the text box filled with a parameter value...
9
by: Taishi | last post by:
ExecuteReader: Connection property has not been initialized. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more...
3
by: Robert Brown | last post by:
Hi All.. I am experiencing Timeouts after about 30-40 seconds when trying to fill a dataset from SQL. I have seen a lot of posts mentioning to set the commandtimeout property, but how do you...
1
by: scottin | last post by:
I setup the dataset, which is the datasource for a datagrid. When I originally fill the dataset, the data is loaded into dataset.tables(0). (dataset.tables(0).rows.count = 8) Then, if a row...
10
by: dauphian | last post by:
Hello, I am new to .net and am trying to build a report application that queries 4 different tables based on a id, and I need to return them in the same table for easy viewing. Basically, I...
2
by: slinky | last post by:
I'm getting a error when I open my . aspx in my browser... line 34: da.Fill(ds, "Assets") Here's the error and my entire code for this .aspx.vb is below that ... I need some clues as to what is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.