This is a discussion on Problem with DataSet within the Microsoft .NET Tutorials and Articles forums, part of the Articles and Tutorials category; Hi, im a newbie in .net. im trying to display the data in a datagrid using DataSet. but im getting ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Problem with DataSet
Hi,
im a newbie in .net. im trying to display the data in a datagrid using DataSet. but im getting an error saying \"type expected\" this error is for dataset declaration. i dont know whats wrong with the declaration. Can anyone help me please. thanks in advance. here is the code Imports System.Data Imports System.Data.SqlClient Public Class Form1 Inherits System.Windows.Forms.Form Dim myConn As SqlConnection = New SqlConnection(\"server=(local);database=tempdb;uid=;pwd=\" Dim myDAdapter As New SqlDataAdapter Dim myDataSet As Dataset = New Dataset \'Error is with DataSet Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load myDAdapter.SelectCommand = New SqlCommand myDAdapter.SelectCommand.Connection = myConn myDAdapter.SelectCommand.CommandText = _ \"SELECT * from test\" myDAdapter.SelectCommand.CommandType = CommandType.Text myConn.Open() myDAdapter.SelectCommand.ExecuteNonQuery() myDAdapter.Fill(myDataSet, \"test\" myConn.Close() grdAuthorTitles.DataSource = myDataSet grdAuthorTitles.DataMember = \"test\" End Sub End Class ---------------------------------------- Quote:
and i even tried Dim myDataSet As New Dataset still im getting the same error |
|
|||
|
Re:Problem with DataSet
try this to get started and getting familier with the database and vbcontrols.
this is full working source code. Version Compatibility: Visual Basic.NET More information: Updated for VB.NET Version 1.0, 03/07/02. If you have trouble running in in IDE, try running the .exe This application provides a detailed and excellent introduction to the new ADO.NET object model. It allows you to connect to an Access or SQL Server database, explore its structure, and run querires against it using its own Query Analyzer. To run the application, download and extract the .zip file and Open the solution file named as DatabaseExplorer.sln. In the case of Access, it is designed to be used for password-protected databases and requires you to identify the System Database for Access (generally in C:\\Program files\\Microsoft office\\Office\\System.mdw). When you connect to the Access database, the application reads the MSysObjects table (see the Query in Connect Method of the CAccessDatabase class), so permission to read this table must be granted to the user. In the case of SQL, login works as it does in the SQL query analyzer, except you have to identify the database you want to view in the login screen. This code has been viewed 62687 times. Instructions: Click the link below to download the code. Select \'Save\' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents. http://www.freevbcode.com/code/VBNET...seExplorer.zip http://www.freevbcode.com/ShowCode.asp?ID=2226 |
![]() |
| Thread Tools | |
|
|