datagridview


Hi reader,

thanks for reading my problem.

i am using data grid view and want to show some data in grid view from database.

so i made the code below but it is giving error in this line dataAdapter.SelectCommand = command;

 

the code is in c#

help me......

 

public SqlConnection connection;//=new SqlConnection();

public SqlCommand command;// = new SqlCommand();

public DataSet dataset;// = new DataSet();

public SqlDataAdapter dataAdapter;

string str = "Data Source=raj;Initial Catalog=CCP;User ID=raj;Password=raj1";

///////////////////////////////////////////

 

connection = new SqlConnection(str);

command = new SqlCommand();

connection.Open();

command.CommandText ="select task_name from task_assignment_master where assign_date = '2006-07-17' and start_time='"+ obj_dt.ToString()+"'";

command.Connection = connection;

dataAdapter.SelectCommand = command;// error: Object reference not set to an instance of an object.

dataAdapter.Fill(dataset,

"task_assignment_master");

dataGridView1.DataSource = dataset.Tables[0];

connection.Close();

 

regards

sameer

0
sameer
7/17/2006 7:01:09 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
693 Views

Similar Articles

[PageSpeed] 32
Get it on Google Play
Get it on Apple App Store

You should new the SqlDataAdapter also:

DataAdapter = new SqlDataAdapter ( ) ;

0
AndokoChandra
7/17/2006 7:38:28 AM
Reply:

Similar Artilces:

Data presentation control in another Data presentation control
 Hello,I want to make a menu with datalist or gridview control.Basically,the menu will be like this,Categories     Sub Categories.For example, for COMPUTING category there will be NOTEBOOKS DESKTOPS etc.There will be a image for CATEGORIES and linkbuttons with Subcategories.If I put a datalist inside a datalist and a link button inside the second datalist visually it satisfies my need.However,CommandArguments come from database to linkbutton.Andwhen one of these command buttons is cliked it must go to proper page.I dont know how to wrie an event_handler ,specifically, for...

How do the different data presentation controls equate in ADO.net?
How does Visual Studio create ado.net equivalents of the datagrid's and gridview's columns and rows?  I am assuming they make a DataRow for each of the rows.  Am I on the right track with this?Is the table created by gridview basically a dataset from ADO.net?  Can anyone offer any guidance with this?Thanks to everyone that has ever helped me with any posts. Hi newbie2C#, The row in datagrid is called DataGridItem and in gridview is called GridViewRow. They are all inherits TableRow Class. DataRow is only one kind of row in GridView control. There are many other t...

Trouble controlling .net controlls with CSS
 I am trying to control the :hover css property on <asp: Button> controls. Basically the css is working correctly to set the initial look of the button, but nothing is happening when I hover over the button. Here is my code:CSS:.sidebarButton{    width: 168px;     height: 45px;     background-color: #666666;     text-align: left;    font-weight: bold;    font-family: Century Gothic;    font-size: 13pt;    color: White;    border-style: none;  ...

ajax control in data presentation controls
can i add ajax controls (MaskedEdit) to presentation controls (dataGrid, dataForm)?? Hi,of course. But keep in mind that those controls are extenders, so you append them to an existing control. Just convert your GridView / DetailsView-fields into templated fields and add the extender you'd like to use to the controls.RegardsMarco Buerckel Don't forget to mark posts that were helpful as answers. Actually, if you looked at the source code for the Masked Edit Extender, you'd see  [TargetControlType(typeof(TextBox))]Meaning, targeting any control type other than textboxes...

Making the .NET calendar control as a floating control
Hi, I need to implement the .NET calendar control as a floating control. Is it possible to do that? If so, can you let me know how to do that?With Regards,Saravana Kumar M R  You could use the calendar extender control in the AJAX control toolkit. You can download the toolkit here, and there is a sample here.My Blog...

Add .Net Control to Web Custom Control
 I want to add .NET Control (like: TextBox, Button...) to Web Custom Control.How i can do it? Alphavn That's called a composite control -- "Mark As Answer" if my reply helped you -- Hello Guys What gunteman said, that is one approach and in most cases the right one.But its also possible to add child controls to a Control thats inherit from WebControl itself. Be sure to implement INamingContainer to that inherited Control too, thats the important point of that approach.--Microsoft MVP - Visual Developer ASP / ASP.NET- http://www.aspnetzone.de/blogs/peterbuch...

Architecture: .Net Controls vs. Custom Controls
I'm interested in managing users. i.e. Logins and profiles, etc.My question is, should I be using things like the Login control or should I program these from scratch? I dont like the fact that .NET creates so many things for me. This level of abstraction terrifies me and it feels like I have no control over the code .I've done a few huge sites in Classic ASP (million-hits-per-day type sites) and I'm not sure how robust certain controls are, or when to use them.Is, for example, the Login control aimed at newbies to .NET? Should it be used for the larger projects with thousands of...

DW control in VB. NET custom control
Hi Just attempting to investigate some DW.NET aspects. In regards to building a ancestor object with VB.NET, why is when I create a datawindowcontrol custom control that any reference to it is like (assuming that u_dw is the name of the DW control): custom_control.u_dw.DatawindowObject = "myDW" instead of simply: u_dw.DatawindowObject = "myDW" If I create a .NET custom control with a button on it, I can directly reference the button's methods and properties without having to qualify it with the custom control's name. When I was developing with po...

data presentation controls (how to call the individual controls)
Hi please help me.,i have this question., example i create a site with one control, like textbox. when i double click on the white page, the page load event, in the intellisense, the textbox is visible, but when a formview with a textbox inside, in the same page load event, intellisense, the textbox is not available. how can i do the simple intellisense calling where the textbox is just outside a data presentation control like formview. i mean by this intellisense calling is in VB code view., thanks JFRBPH12™  The textbox is within the formview then you can find it like this...

What is the real difference between Server Controls and .NET controls?
This was a class discussion question and I'd like to know, what exactly are the differences? Is there a clear answer? .NET framework controls are server controls. The only difference that I can think of is that the .NET controls are part of the FCL (Framework Class Library). HTH,RyanRyan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question...

Is there any way to control the width of the Gridcolumn when the data is present and not present
I would like to know if there is any way you can control the gridview column width. Thanks in advance. Digish Hi,   try these link http://www.eggheadcafe.com/community/aspnet/17/10004157/setting-gridview-column-w.aspx http://msdn.microsoft.com/en-us/library/ms178296(VS.80).aspxBabaIf this post was useful to you, please Don't forget to click "Mark as Answer". Thanks You.:-)...

How to make a .NET assembly to control a service which built by .NET?
i need to build a service to be a quota service by .NET but i need to build a .NET assembly to manage the service by web so, how to build a assembly to control it?Parco LeeOwner + Webmaster + System Engineer + Professional ProgrammerSoftDweller Lab (a software laboratory)http://www.softdweller.comA professional laboratory for new technology softwares developing by .NET.http://www.nowlover.com You need to build a class that uses a ServiceController. You can attach the servicecontroller to the service, and use it to stop, start, pause etc. it. I have a blog. Perhaps you'd like to rea...

DataWindow.Net a nominee for Best .NET Libraries / Controls
http://sys-con.com/dotnet/readerschoice2004/ Bruce Armstrong [TeamSybase] http://www.teamsybase.com TeamSybase blogs: http://www.teamsybase.net/blogs Two 3rd party books on developing with PowerBuilder http://www.pb9books.com?source=newsgroups Need code sample? Check out CodeXchange: http://www.codexchange.sybase.com Preach the gospel at all times. If necessary, use words. - Francis of Assisi http://www.needhim.org --------------------------------------------------------------------- NOTE: If you are using Google to post messages to the newsgroups, you will *no...

ajax.net controls used in custom composite controls?
I am creating an events calendar that uses the accordion to display the events for the selected day.  The problem I'm having is that the accordion is not responding to any client side events.  I would really like to find a good "How to" article for building composite controls that incorporate an ajax.net control like the accordion....

using a .Net Control as activex control in VCL form
Hi , We have a to integrate a simple .Dot CSharp control which needs to be integrated into bcb2010 VCL form as a control. We will place the control on the VCL form along with other VCL controls's. I tried creating a simple .net control using a lable+textbox and trying to use in vcl form. I have made the assembly comvisible and generated tlb files and .bpl for the component. I could see the component in "ActiveX" tool palette. But when I drag the object onto VCL form and try to access its attributes I run into problems. I am not able to see .net control on the vcl at runti...

Web resources about - datagridview - asp.net.presentation-controls

Newest 'entity-framework' Questions - Stack Overflow
Q&A for professional and enthusiast programmers

Mono 2.0 released, brings C# 3.0 to Linux and Mac OS X
The Mono project, which develops an open-source and cross-platform …

CodePlex - Project Directory
Project hosting for open source software.

Quick Answers - CodeProject
Questions - Free source code and tutorials for Software developers and Architects.; Updated: 11 Jul 2012

C# Corner - Developers and IT Professionals Community
Community for Developers and IT Professionals

Synchronize Now!
Eric uses Amazon.com's S3 web service and .NET 2.0's FtpWebRequest class to securely synchronize files on multiple machines.

Gabriel Mongeon
Archive - Gabriel Mongeon

Debugging Tool: Build a Logging and Event Viewing Library to Help Debug Your .NET Framework-based App ...
Sign in MSDN subscriptions Get tools http://www.facebook.com/microsoftdeveloper https://twitter.com/msdev http://plus.google.com/111221966647232053570/ ...

Utilities - Software Downloads - PCWorld
Utilities downloads software and reviews .NET DataGridView Columns assembly for .NET 2.0, 3.0, 3.

Tutorials - Switch on the Code
Username: Password: Register - Forgot Password Home Tutorials Forums News & Other Posts Podcast About Us Contact Us Tutorials .NET C# Snippet ...

Resources last updated: 1/5/2016 4:14:07 PM