473,800 Members | 2,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please help on this problem, Pretty Please

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
4 1336
all your logic, and all your bugs, are in the SQL statements. You didn't
include the stored procs in your post, so there's not much I can do to help.

not sure what you mean "adding two new columns"... the datagrid will simply
reflect the columns that come back in your select stmt... has nothing to do
with the insert stmt.

--- Nick

"mattgcon" <ma******@discu ssions.microsof t.com> wrote in message
news:D4******** *************** ***********@mic rosoft.com...
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
Nick,

The last stored procedure wasn't complete here is the complete stored proc:

ALTER PROCEDURE dbo.assetInsert
(
@aid int,
@type char(50)
)
AS
SET NOCOUNT OFF;
INSERT INTO asset_types(aid , type) VALUES (@aid, @type);
SELECT aid, type FROM asset_types WHERE (aid = @aid)

"Nick Malik" wrote:
all your logic, and all your bugs, are in the SQL statements. You didn't
include the stored procs in your post, so there's not much I can do to help.

not sure what you mean "adding two new columns"... the datagrid will simply
reflect the columns that come back in your select stmt... has nothing to do
with the insert stmt.

--- Nick

"mattgcon" <ma******@discu ssions.microsof t.com> wrote in message
news:D4******** *************** ***********@mic rosoft.com...
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
Nick,

I have some screen shots of the "new columns" if you would like me to send
them to you.
Here is the stored procedure:

ALTER PROCEDURE dbo.assetInsert
(
@aid int,
@type char(50)
)
AS
SET NOCOUNT OFF;
INSERT INTO asset_types(aid , type) VALUES (@aid, @type);
SELECT

"Nick Malik" wrote:
all your logic, and all your bugs, are in the SQL statements. You didn't
include the stored procs in your post, so there's not much I can do to help.

not sure what you mean "adding two new columns"... the datagrid will simply
reflect the columns that come back in your select stmt... has nothing to do
with the insert stmt.

--- Nick

"mattgcon" <ma******@discu ssions.microsof t.com> wrote in message
news:D4******** *************** ***********@mic rosoft.com...
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 #4
Your original post does not show a couple of things:
1. Where dataTable1 is getting populated
2. Assuming that you omitted the code that sets dataTable1=
dataSet1.Tables[0], then you need to show us the stored procedure used to
populate it (the name of which would be stored in SQLSelectSP). This is most
likely where your problem is.

As the other responder said, this likely has nothing to do with your insert
statement - so don't know why you posted it... much less why you didn't post
the procedure that populates dataSet1.Tables[0].

Your grid is being bound to dataTable1 - so if dataTable1 is not pointing to
dataSet1.Tables[0] then you have to find out what is populating it.

GH
"mattgcon" <ma******@discu ssions.microsof t.com> wrote in message
news:E5******** *************** ***********@mic rosoft.com...
Nick,

I have some screen shots of the "new columns" if you would like me to send
them to you.
Here is the stored procedure:

ALTER PROCEDURE dbo.assetInsert
(
@aid int,
@type char(50)
)
AS
SET NOCOUNT OFF;
INSERT INTO asset_types(aid , type) VALUES (@aid, @type);
SELECT

"Nick Malik" wrote:
all your logic, and all your bugs, are in the SQL statements. You didn't include the stored procs in your post, so there's not much I can do to help.
not sure what you mean "adding two new columns"... the datagrid will simply reflect the columns that come back in your select stmt... has nothing to do with the insert stmt.

--- Nick

"mattgcon" <ma******@discu ssions.microsof t.com> wrote in message
news:D4******** *************** ***********@mic rosoft.com...
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 #5

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

Similar topics

7
1495
by: Francis Bell | last post by:
Hello, I've got a 25 line file with lines of data like this: sp/spinnerbait/AAA Lures/Mad Phil/silver/bass/1/1 The first field is the code that determines what to do. I need to loop through this data file and, based on that first field, execute different cases in a switch statement (yes, there's only one now...I'm in a building process, and I need to get the first one to read first.). However, it's only going through 1 time and it should...
6
1433
by: Ubi | last post by:
hi i have a problem with System.Data.DataViewRowState. i have a ReadOnly datagrid, a dataView and a dataTable. i'm using the dataView's filter property to filter the data (firstName = 'Dani'). the problem is that i don't understanh how the ViewRowState works: i have an external form that changes the value of the dataTable.
4
3017
by: Gary Hughes | last post by:
Hi all, sometime I posted a problem in here where I was getting the following error from the linker in VS C++ 2003. Linking... GCClass.obj : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: GCClass; fields: m_blah): (0x04000001). LINK : fatal error LNK1215: metadata operation failed (80131130) :
4
6208
by: Madhu Gopinathan | last post by:
Hi All, I am faced with a horrible hang problem. I have a COM exe server that executes some tasks. The task execution manager is a thread that manages the pool of threads, which is 4 per processor. Each task is processed in a separate thread. Each of the executer threads is an STA thread, and it goes ahead and executes the task. No problems are encountered when tasks are executed one at a time, but when multiple tasks are executed...
0
1746
by: KathyB | last post by:
Hi, Using the following in an asp.net procedure. I get the error "The expression passed to this method should result in a NodeSet". Dim xDoc As New Document() The line causing the error is: Dim n as XmlNode = xDoc.SelectSingleNode("//Station="Station1"]/WI/]/@order")
4
1923
by: MooMaster | last post by:
I'm trying to develop a little script that does some string manipulation. I have some few hundred strings that currently look like this: cond(a,b,c) and I want them to look like this: cond(c,a,b)
3
1600
by: Robert Dufour | last post by:
I am trying to localize a very simple web site (english and french) I have a master page and one content page for now. On the master page I have placed a Localize control On the content page I have placed a label and a dropdownlist. The label says "Use this language" or "Utilisez cette laague" The dropdownlist Contains values "en-US" text Englsih Us and "fr-CA" text "French Canada)
62
2735
by: vubaboota | last post by:
I HAVE SOME SERIOUS PROBLEM , HOW TO MAKE A PROGRAM IN C Q1: Write a program using malloc function. In which you take input from user and allocate memory equal to square of this number. Which multiply numbers and draw a table in the following format? Hint: User enters 3 then program allocates equal to 9 integer memories. Output:1
0
9691
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
9551
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
10507
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10279
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10255
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10036
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
6815
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.