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? 2 1732
"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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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)...
|
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);...
|
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....
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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...
|
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...
| |