473,610 Members | 2,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid and INSERT problem

When I use a stored procedure to insert data into a table and when the
Datagrid refreshes two new columns are added. The dataSet is set up with one
table with NO columns defined. Please help me on this. I have screen shots of
the before and after.

Here is the code:

sqlCommand.Comm andType = CommandType.Sto redProcedure;
sqlCommand.Comm andText = SQLInsertSP;
sqlCommand.Para meters.Add("@ai d",SqlDbType.In t,4);
sqlCommand.Para meters.Add("@ty pe",SqlDbType.V arChar,50);
sqlCommand.Para meters["@aid"].Value = tAID;
sqlCommand.Para meters["@type"].Value = tValue;
sqlADBAdapt.Ins ertCommand = sqlCommand;

//This is the point where the Insert Statement is working but its adding two
new columns

sqlADBAdapt.Upd ate(dataSet1);
sqlCommand.Para meters.Clear();
sqlCommand.Comm andType = CommandType.Sto redProcedure;
sqlCommand.Comm andText = SQLSelectSP;
try{
sqlADBAdapt.Sel ectCommand = sqlCommand;
sqlADBAdapt.Fil l(dataSet1.Tabl es[0]);
}
catch(SqlExcept ion ae){
MessageBox.Show (ae.Message.ToS tring());
}
dataGrid1.DataS ource = dataTable1;
dataGrid1.ReadO nly=true;
Nov 16 '05 #1
3 3329
I wrote this awhile ago, but no one answered it, Can anyone please help me on
this

"mattgcon" wrote:
When I use a stored procedure to insert data into a table and when the
Datagrid refreshes two new columns are added. The dataSet is set up with one
table with NO columns defined. Please help me on this. I have screen shots of
the before and after.

Here is the code:

sqlCommand.Comm andType = CommandType.Sto redProcedure;
sqlCommand.Comm andText = SQLInsertSP;
sqlCommand.Para meters.Add("@ai d",SqlDbType.In t,4);
sqlCommand.Para meters.Add("@ty pe",SqlDbType.V arChar,50);
sqlCommand.Para meters["@aid"].Value = tAID;
sqlCommand.Para meters["@type"].Value = tValue;
sqlADBAdapt.Ins ertCommand = sqlCommand;

//This is the point where the Insert Statement is working but its adding two
new columns

sqlADBAdapt.Upd ate(dataSet1);
sqlCommand.Para meters.Clear();
sqlCommand.Comm andType = CommandType.Sto redProcedure;
sqlCommand.Comm andText = SQLSelectSP;
try{
sqlADBAdapt.Sel ectCommand = sqlCommand;
sqlADBAdapt.Fil l(dataSet1.Tabl es[0]);
}
catch(SqlExcept ion ae){
MessageBox.Show (ae.Message.ToS tring());
}
dataGrid1.DataS ource = dataTable1;
dataGrid1.ReadO nly=true;

Nov 16 '05 #2
What is the value of SQLSelectSP?


"mattgcon" <ma******@discu ssions.microsof t.com> wrote in message
news:B2******** *************** ***********@mic rosoft.com...
I wrote this awhile ago, but no one answered it, Can anyone please help me on this

"mattgcon" wrote:
When I use a stored procedure to insert data into a table and when the
Datagrid refreshes two new columns are added. The dataSet is set up with one table with NO columns defined. Please help me on this. I have screen shots of the before and after.

Here is the code:

sqlCommand.Comm andType = CommandType.Sto redProcedure;
sqlCommand.Comm andText = SQLInsertSP;
sqlCommand.Para meters.Add("@ai d",SqlDbType.In t,4);
sqlCommand.Para meters.Add("@ty pe",SqlDbType.V arChar,50);
sqlCommand.Para meters["@aid"].Value = tAID;
sqlCommand.Para meters["@type"].Value = tValue;
sqlADBAdapt.Ins ertCommand = sqlCommand;

//This is the point where the Insert Statement is working but its adding two new columns

sqlADBAdapt.Upd ate(dataSet1);
sqlCommand.Para meters.Clear();
sqlCommand.Comm andType = CommandType.Sto redProcedure;
sqlCommand.Comm andText = SQLSelectSP;
try{
sqlADBAdapt.Sel ectCommand = sqlCommand;
sqlADBAdapt.Fil l(dataSet1.Tabl es[0]);
}
catch(SqlExcept ion ae){
MessageBox.Show (ae.Message.ToS tring());
}
dataGrid1.DataS ource = dataTable1;
dataGrid1.ReadO nly=true;

Nov 16 '05 #3
mattgcon <ma******@discu ssions.microsof t.com> wrote:
I wrote this awhile ago, but no one answered it, Can anyone please help me on
this


I suggest you ask on the .adonet newsgroup, with a more descriptive
subject line.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2735
by: SammyBar | last post by:
Hi, I'm trying to bind a custom collection class to a data grid, following the guidelines from the article http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx. The problem is the article is in VisualBasic. I already get the collection to be recognized as a Data Source by the IDE. It populated the DataGrid correctly from the fields on the items object of the collection, but I can't get the DataGrid to...
7
2689
by: Pierluigi Terzoli | last post by:
Hi everybody, I need help for this problem: I'm using a DataGrid to Insert/Modify/Cancel data from a single table. At the moment, every cell modification of a pre-existing row is correctly update on the DB. I have some doubts about inserting a new row. The table has a Id field that is a primary key defined ad Identity properties on SQLServer engine. This column isn't visible on the grid and a properties DefaultValue=0 is defined.
8
1937
by: Inigo Jimenez | last post by:
I have an ASP .net web application installed in a Windows 2003 server. This web application has a webform that has a Datagrid. This Datagrid is filled with the data of a SQL table. I have a button that inserts a new row in the SQL table and then refresh the datagrid.
9
5050
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ******************************************************************************* <asp:DataGrid visible="False" border=1
16
1671
by: tshad | last post by:
I am trying to center a button in a datagrid column in asp.net and it doesn't seem to work. I have the following: <asp:TemplateColumn ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center"> <FooterTemplate> <asp:LinkButton CommandName="Insert" Text="<img src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
5
3238
by: Chris | last post by:
Based upon some prevoius postings on what to do for adding a 'add' row to a datagrid I utilize the footer to create the 'add' row. The only issue is that I have it sharing the 'UpDate_Command' and I use an argument to difference between an 'edit' vs. and 'add. But since I have field validation on both 'footer' and 'edit' columns I can't submit my edits since the footer validation kicks in.If I take the validation off then the both work fine...
0
955
by: Charles Watson | last post by:
datagrid won't refresh I can see in other groups that this is a big problem in vb6/sp5. any answers? I get data off a form of input boxes, insert it into the datagrid. I change something on the form page input boxes, recalculate, re insert new data into the datagrid, and every datagrid box I didn't insert new data into
10
2334
by: Nick | last post by:
Hello, Please pardon my ignorance as I'm sure this is easy to do. I have a datagrid where I want to let the user delete columns. I added a context menu to the datagrid that has a delete option. If the user right clicks on a column heading can I highlight that column and then delete it? I'm not exactly sure how to highlight it or figure out what column has been clicked. In my testing so far when I use the context menu I always get the...
0
1747
by: Erik | last post by:
Why isn't my update method getting called? Pasted below is an aspx from a 1.1 application I'm working on. It has two textboxes and a button for inserting data into the database, and a datagrid for editing and deleting data. When a user clicks on the "Edit" button in the datagrid, Edit() method is called and the appropriate row is changed into textboxes. And if user clicks on the "Update" button, the Update() method is fired. But if...
5
2218
by: rcoco | last post by:
Hi, I'm working on a asp.net project with a datagrid. I want the user to be adding data into Sql database using the datagrid. So I'm using a ListBox to do this and edit update and delete. I placed listbox in EditItemTemplate and label in ItemTemplate. but when I try now to edit it does not bring the lisbox but i can read the grid with the sql content. my code actually looks like this: public void Edit_dgid(object source,...
0
8148
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8097
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8411
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7036
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4040
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2545
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1692
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.