|
Hi,
How can I sort the DataGridView by one column and then by another column?
I saw a solution for unbound data only, and I have bound data GridView..
Thanks
dana Tov
|
|
|
|
|
Hi,
I am creating an application in which the user can select the stored procedures in the sql server and then they can assign the values to the parameters of the procedure and they can execute it.
So i want to get the parameter list of the selected procedure.
Can you please tell me the way to get the parameter name and the datatype of the same for a stored procedure?
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Assuming the stored procedure is declared as follows:
SqlCommand _myProcedure = new System.Data.SqlClient.SqlCommand();
The parameters are listed in the collection _myProcedure.Parameters which is of type SqlParameterCollection . Loop through this collection to get every parameter and get all the info you want from it.
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
It is not giving the parameter list.
I tried as follows:
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(@"Data Source=MyMachine\SQLEXPRESS;Initial Catalog=VersatileData;User ID=sa");<br />
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("vsp_RetrieveEventDetails", con);<br />
cmd.CommandType = CommandType.StoredProcedure;<br />
con.Open();<br />
cmd.Prepare();<br />
MessageBox.Show(cmd.Parameters.Count.ToString());<br />
foreach (System.Data.SqlClient.SqlParameter sqlParam in cmd.Parameters)<br />
{<br />
MessageBox.Show(sqlParam.ParameterName.ToString());<br />
}<br />
cmd.ExecuteNonQuery();<br />
con.Close();
It is giving the parameter count as Zero(0).
I am not interested in executing the query but i want to get the parameter alone if the user selects the procedure
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
M. J. Jaya Chitra wrote: It is giving the parameter count as Zero(0).
That is because it doesn't actually retrieve the parameter list. I suspect the other person either didn't understand your question or just made an answer up that sounded like it might work.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
M. J. Jaya Chitra wrote: Can you please tell me the way to get the parameter name and the datatype of the same for a stored procedure?
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS ROUTINE_COLUMNS
-- modified at 7:09 Thursday 9th August, 2007
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
Colin Angus Mackay wrote: SELECT * FROM INFORMATION_SCHEMA.ROUTINE_COLUMNS
It returned blank rows for me, and I doubt how this can get parameters from stored procedures ?
|
|
|
|
|
N a v a n e e t h wrote: It returned blank rows
I think you mean it returned no rows. If it returned rows there would have been information in them.
N a v a n e e t h wrote: I doubt how this can get parameters from stored procedures ?
Oops. You are right - it is for functions, not stored procedures.
The correct view is INFORMATION_SCHEMA.PARAMTERS
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
Colin Angus Mackay wrote: The correct view is INFORMATION_SCHEMA.PARAMTERS
Exactly, that worked... More specifically
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS WHERE
specific_name = 'ProcedureName'
|
|
|
|
|
Thank you.
It is working and once again thanks for all of your timely help
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
how many controll into a panel,(inclue:howmany comboboxs,textboxs,labels ...
|
|
|
|
|
Do you mean how many can you fit ? More than could ever be considered sensible
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
you can count them yourself:
foreach(Control c in myPanel.Controls) {
if (c is TextBox) tbCount++;
if (c is ListBox) lbCount++;
if (c is Button) btnCount++;
...
}
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Ah... guessing what it is people are asking is becoming an art in and of itself....
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Programming may be an art form, contributing to CodeProject is one for sure
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
As much as your stack and heap supports.
Regards,
Valan
|
|
|
|
|
Hello,
I am trying to handle the LButtonUp message of form title bar.
The message is getting invoked only for double Click on title bar.
How can i handle the LButtonUp event on Form title bar??
Thanks.
Gajesh
|
|
|
|
|
Hi,
if nothing else works for you, you can always override the WndProc method;
here is an example from my CodeRescue article for getting hotkey messages:
protected override void WndProc(ref Message m) {
if(m.Msg==0x0312) {
int lParam=(int)m.LParam;
if(lParam==0x00710002) RescueCode();
}
base.WndProc(ref m);
}
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hello
VS 2005
I am creating a setup project using the deployment project.
I have added a user interface to the setup. Right click setup project | View | User interface.
The problem I am having is I need to have dialog with 2 radio buttons i.e.(A and B). If the user selects A they will enter the details of something (will need 2 text boxes). If they select B then they will need 4 text boxes.
BTW, The user interface dialog boxes are not very flexible as you cannot drag and drop you own controls on to it.
Is there a way to have 2 radio button and hide or make visible the text boxes that the user will enter into.
Many thanks for any help or suggestions,
Steve
|
|
|
|
|
Deployment is done with an msi, and no, you can't just build your own dialog forms for it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello,
I thought maybe you could point me in the right direction of using the dialog boxes that come with the setup editor.
Based on the conditions of using 2 radio buttons, it will display either 2 text boxes or 4.
Thanks for any more suggestions,
Steve
|
|
|
|
|
|
Hi I am working on a windows Application. I want to store the Passwords in SQL server 2005 in encrypted format. How to do this?
And Again how to validate the credentials with an user input
|
|
|
|
|
If you do not need to retrieve the password that was stored, you can use a hash version of it. When a user enters his username and password in your application, you would hash the password and compare it to the hash that you have in the database to see if it matches.
If you need to have a way to retrieve the password, you cannot use hash, you need to apply an encryption algorithm to be able to decryt it later.
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Thanks for reply
Can you just send me a sample of hashing.
|
|
|
|