473,394 Members | 1,841 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,394 software developers and data experts.

problem passing parameters

hi

asp.net 2.0

I have a gridview which I'm trying to update a row within. When I click on
the Update button, my website crash. It displays a webpage saying that a
parameter is missing. So I wonder what's wrong in my code. Below I post
parts of my code

<asp:ObjectDataSource ID="odsPhoneType"
TypeName="SqlPhoneProvider"
SelectMethod="getPhoneTypes" UpdateMethod="updatePhoneType"
InsertMethod="insertPhoneType" runat="server">
<UpdateParameters>
<asp:Parameter Type="Int32" Name="Id" />
<asp:Parameter Type="Char" Name="type" Direction="Input" />
<asp:Parameter Type="string" Name="desc" Direction="Input" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Type="Char" Name="Type" />
<asp:Parameter Type="string" Name="Desc" />
</InsertParameters>
</asp:ObjectDataSource

public override void updatePhoneType(int id, char type, string desc)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("UpdatePhoneType", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@id", SqlDbType.Int).Value = id;
cmd.Parameters.Add("@type", SqlDbType.NChar).Value = type;
cmd.Parameters.Add("@desc", SqlDbType.NVarChar).Value = desc;
cn.Open();
cmd.ExecuteNonQuery();
}
}

it complains about @desc, but I guess this problem is for @type also

any suggestions?
Oct 22 '08 #1
2 1734


"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uE**************@TK2MSFTNGP06.phx.gbl...
hi

asp.net 2.0

I have a gridview which I'm trying to update a row within. When I click on
the Update button, my website crash. It displays a webpage saying that a
parameter is missing. So I wonder what's wrong in my code. Below I post
parts of my code

<asp:ObjectDataSource ID="odsPhoneType"
TypeName="SqlPhoneProvider"
SelectMethod="getPhoneTypes" UpdateMethod="updatePhoneType"
InsertMethod="insertPhoneType" runat="server">
<UpdateParameters>
<asp:Parameter Type="Int32" Name="Id" />
<asp:Parameter Type="Char" Name="type" Direction="Input" />
<asp:Parameter Type="string" Name="desc" Direction="Input" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Type="Char" Name="Type" />
<asp:Parameter Type="string" Name="Desc" />
</InsertParameters>
</asp:ObjectDataSource

public override void updatePhoneType(int id, char type, string desc)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("UpdatePhoneType", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@id", SqlDbType.Int).Value = id;
cmd.Parameters.Add("@type", SqlDbType.NChar).Value = type;
cmd.Parameters.Add("@desc", SqlDbType.NVarChar).Value = desc;
cn.Open();
cmd.ExecuteNonQuery();
}
}

it complains about @desc, but I guess this problem is for @type also

any suggestions?
Are you sure the updatePhoneType is called, can you put a breakpoint in
there?

--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name

Oct 22 '08 #2
Are you sure the updatePhoneType is called, can you put a breakpoint in
there?

Yes, I put a breakpoint in that method and it get triggered during runtime
Oct 22 '08 #3

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

Similar topics

7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
33
by: hermit_crab67 | last post by:
Can someone explain to a C newbie why this doesn't work as I expect it to work? (expectations clearly outlined in the printf statement in main routine) OS: Linux 2.4.26 GCC: 2.95.4 void...
5
by: Jason Huang | last post by:
Hi, The SqlParameter myPM =new SqlParameter("@Address", txtAddress.Text) is working for update, but SqlParameter myPM =new SqlParameter ("@Address",SqlDbType.NVarChar,90,txtAddress.Text) is...
2
by: Simon Harvey | last post by:
Hi everyone, I'm having a really simple problem - I can't seem to insert a null value into the database. When I do it tells me that the procedure expects the parameter and that I'm not providing...
9
by: burningsunorama | last post by:
Hi guys! This is maybe a too 'academic problem', but I would like to hear your opinions, something like pros and cons for each approach.... ... Recently we've had at work a little talk about the...
5
by: mk | last post by:
Hi all, The requirement is like this.. I have to update the table with the parameters from front end like at some times i need to update one parameters and some times i have to update more...
11
by: krishnakant Mane | last post by:
hello, I finally got some code to push a pickled list into a database table. but now the problem is technically complex although possible to solve. the problem is that I can nicely pickle and...
4
by: kinaxx | last post by:
Hello, now I'm learning progamming language in university. but i have some question. in textbook. says there are four passing Mechanism 1) pass by value (inother words : call by value) 2)...
2
by: csmith8933 | last post by:
How do I write a function where the number of parameters it takes varies? This is what I have but it doesnt work. // function prototype void functionThree(int num1=1, int num2=2, int num3=3);...
5
by: fishwater00 | last post by:
I need to read parameters from a file called "params", the following is part of codes which can read parameters from that file. But I am not totally understand. Hope anyone can give detailed answers....
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:
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...

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.