Few questions about dataGrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

helo
i have few questions about working with datagrid

1. after i got help from this forum i succeded to move between columns by preesing the enter key, now my questio
is how can i decdied which column to move to

2. i bind my datagrid with a stored procedure from my sql database (by using dataadapter,dataset ...) and i need to send a parameter to the stored procedure, how can i do it? the wizard that opens when i drag the dataadapter doesn't give this option..

thank you all
 
1) You can use the CurrentCell property to determine where you moved to .
It has a rowIndex and a columnIndex so you can use the columnINdex to
determine this
2) You aren't binding to a Stored Procedure you are binding to a
datatable/DataReader/Dataset that was generated from a Stored proc. In
general, the select command (and the rest provided that they could be
generated) can be overridden by you. You can just change the select command
and here's how to call a Stored Proc and use Parameters
http://www.knowdotnet.com/articles/storedprocsvb.html
Now, you can still use the Update/Insert/Delete commands that were
genereated or you can build your own. All you need to do is at the
beginning, change the Select command sometime before you call .Fill, and add
the parameter(s) to the command's parameters collection and make sure you
set the commandType to CommandType.StoredProcedure.

The update/delete/insert commands (provided they were generated) will add
the params and the column mappings.... but you can use whatever select
command you want and whatever other commands you want with the same adapter,
unless of course you are using a CommandBuilder (if you are, don't - they
are really lame) which infers its update logic from the select command.

HTH,

Bill

--
W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/
Gidi said:
helo,
i have few questions about working with datagrid:

1. after i got help from this forum i succeded to move between columns by
preesing the enter key, now my question
is how can i decdied which column to move to?

2. i bind my datagrid with a stored procedure from my sql database (by
using dataadapter,dataset ...) and i need to send a parameter to the stored
procedure, how can i do it? the wizard that opens when i drag the
dataadapter doesn't give this option...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top