|
As has already been said, it could be a null SelectedRow, or the value in the Cells might be null. What you need to do is put a breakpoint on the line with the first AddWithValue (just click F9 to insert the breakpoint), and then run the application. When you hit this method, hover your mouse over the different properties until you see one that pops up the tooltip "null".
There - now you know how to solve these issues for yourself.
|
|
|
|
|
hi,
but i need to input values to the blank cells. i cannot populate them with some other values. they has to be null/blank.
|
|
|
|
|
First of all try to explain what you want to do with the code.
if you want to store the value (which is added directly in the gridview) in the database,
then try to use GridView2.Rows[e.RowIndex].Cell[3].Text for all the cells, becuase it can be possible that no rows selected at that time.
also assign the Values of the gridview to some variable and the check wether the value is null or not.
i.e.
string FilledDate = GridView2.Rows[e.RowIndex].Cell[3].Text;
if (FilledDate != null)
cmd.Parameters.AddWithValue("@filleddate", FilledDate);
else
cmd.Parameters.AddWithValue("@filleddate", "");
-----------------------
or you can use directly
e.NewValues[3] Instead of GridView2.SelectedRow.Cells[3].Text
in your original code.
e.NewValue will give you all the new updated values.
e.OldValue will give you all the old existing values.
do this for all the fields.
and one more thing give GridView2 some appropriate Name, instead of using auto generated name.
|
|
|
|
|
This is quite confusing. Your procedure name is InsertSuite, which sounds like you're inserting data into the database. However you're executing a reader so it seems like you're actually fetching data. This is also the impression from your replies.
If you're trying to update the database I think you should use e.RowIndex to get the actual row, but if you're trying to fetch the data I think you should use different event since RowUpdating is raised when rows update button is clicked.
|
|
|
|
|
SALAM SIR;
HOW CAN MADE MESSENGER IN C#.NET?
HOW CAN MADE STUDENT FORM IN C#.NET?
THANKS SIR
mohammedali
|
|
|
|
|
Forth time already? No means no, go away. A student can research[^] or even go to a class[^] every now and then and LEARN SOMETHING.
We are NOT going to do your work!
To get you to stop posting this, pay a real coder over at rentacoder[^] where they will be glad to do your work... for money.
|
|
|
|
|
EliottA wrote: pay a real coder over at rentacoder[^]
OMG, that was funny!
|
|
|
|
|
You know what I mean Dave.
|
|
|
|
|
Oh, of course I do!
|
|
|
|
|
hi
am search from someone who can make small program for me
thank you
f0f020002000@yahoo.com
|
|
|
|
|
Then you've come to the wrong web site. Usually, that's for some homework assignment or some contract job that the person took on and has no idea how to do it. In either case, noone is doing you anyn favors by doing your work for you.
If you want something written for you, go to http://www.RentACoder.com[^]
|
|
|
|
|
EliottA wrote: where they will be glad to do your work... for money.
yes yes, i will be glad...
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
mohammedali2006 wrote: HOW CAN MADE MESSENGER IN C#.NET?
HOW CAN MADE STUDENT FORM IN C#.NET?
Your questions do not make any sense so it is unlikely that you will get any kind of helpful answer
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
Review his posts. Its been a couple of months, he is probably redoing some course that he didn't study for again. He wants an Instant messenger of some kind coded in .net given to him so he can change the name and submit it.
|
|
|
|
|
1. Repeat, repeat, repeat...repeat!
2. All caps
3. Can't use Google
"Well, we're getting "F"'d at work. WPF, WCF, and WWF... WTF?" --John Simmons
|
|
|
|
|
Please don't be so rude: add 'SALAM SIR'
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
don't forget to address him as sir!
|
|
|
|
|
Fixed.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
20$ if you can click his url in his profile clickety[^] and stare at it for 10 minutes without wanted to stab your eyes.
|
|
|
|
|
My eyes! My EEEYEEES! [insert eyeless emoteicon here]
|
|
|
|
|
I failed. Where do I send the $20
*EDIT* ...and 10 minutes? I did 30 seconds before I started pouring
gasoline on myself while trying to light my Zippo.
....and my eyes are still trying to readjust.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I just passed out! :P
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
Easy - I have young daughters who like yucky shades of pink. Feel free to forward the $20.
|
|
|
|
|
|
Darn. I think that my color profile just broke...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|