|
So, if I get this right, what you're saying is that you don't know anything about C# at all and have done nothing to try to learn it ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Sorry, i have learned C# for 2 weeks
<br />
SqlConnection connect = new SqlConnection(ConnectionFactory.strconn);<br />
connect.Open();<br />
cmd = new SqlCommand("Proc_student_Add", connect);<br />
cmd.CommandType = CommandType.StoredProcedure;<br />
cmd.Parameters.Add(new SqlParameter("MaxID",varScenario.ID));<br />
<br />
With that stored procedured i can't get return value by "int i = cmd.ExecuteNonQuery();", please help me to resolve this problem.
Thank !
|
|
|
|
|
SqlCommand sampleCMD = new SqlCommand("SampleProc", nwindConn);
sampleCMD.CommandType = CommandType.StoredProcedure;
SqlParameter sampParm = sampleCMD.Parameters.Add("RETURN_VALUE", SqlDbType.Int);
sampParm.Direction = ParameterDirection.ReturnValue;
sampParm = sampleCMD.Parameters.Add("@InputParm", SqlDbType.NVarChar, 12);
sampParm.Value = "Sample Value";
sampParm = sampleCMD.Parameters.Add("@OutputParm", SqlDbType.NVarChar, 28);
sampParm.Direction = ParameterDirection.Output;
nwindConn.Open();
SqlDataReader sampReader = sampleCMD.ExecuteReader();
Console.WriteLine("{0}, {1}", sampReader.GetName(0), sampReader.GetName(1));
while (sampReader.Read())
{
Console.WriteLine("{0}, {1}", sampReader.GetInt32(0), sampReader.GetString(1));
}
sampReader.Close();
nwindConn.Close();
Console.WriteLine(" @OutputParm: {0}", sampleCMD.Parameters["@OutputParm"].Value);
Console.WriteLine("RETURN_VALUE: {0}", sampleCMD.Parameters["RETURN_VALUE"].Value);
|
|
|
|
|
That's a whole lot more work than is necessary, but I accept it would work.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thank you very much
|
|
|
|
|
If you've been learning C# for two weeks, why are you working on calling stored procedures ? There's no way that's a sensible next step for you at this point.
The MSDN site is a good place to look for documentation. You should really also own at least one C# book. Either way, ExecuteNonQuery returns a number that tells you how many rows were changed. The documentation will tell you this. I told you in the first instance that you should call ExecuteScalar, if you had any idea what you were doing, or willingness to do a little research, you should have been able to work that out. Even the intellisense would show you the answer.
If you're doing a course, you should talk to your teacher about getting some resources to help you do some basic research. If, as I expect, you're doing paid work, then you're yet another example of the disgraceful excuse for an industry that has popped up in the third world, where people with no experience work on paid systems and then expect the people in the West who lose their jobs to you, to do the work for you. There is no level on which someone who started to learn C# two weeks ago, should be working on this sort of code, unless they have sufficient experience in another language to be able to do some basic research for themselves and to understand a post like my initial reply.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
Get the value that returned
Thank !
|
|
|
|
|
|
CREATE PROCEDURE [dbo].[Proc_Scenario_GetMaxID]
(
@MaxID int OUTPUT
)
as
if exists(SELECT [ID] FROM student)
SELECT @MaxID = MAX(ID) FROM student
else
SET @MaxID=1
----------------------------
Because '@MaxID' is OUTPUT
So Your stored procedure...
----------------------------
Chinese programmers: 狼人软件
|
|
|
|
|
REATE PROCEDURE Proc_Scenario_GetMaxID
@MaxID int OUTPUT
as
BEGIN
if((SELECT MAX(ID) FROM student) is not null)
begin
SET @MaxID = (SELECT MAX(ID) FROM student)
return 0
end
else
Begin
SET @MaxID=1
return 1
END
end
code for execution :--
declare @i int
exec Proc_Scenario_GetMaxID @i output
print convert(char(4),@i))
|
|
|
|
|
Hello,
I want to create a simple alternative of PowerPoint slides.
I'll try to explain what I want to program.
I want a form that displays some slides which the contents are stored in the database. This can be a simple text, image or a video. I also want to have a kind of Marquee on bottom of the form. I thought about using DirectX for smooth Marquee, but don't know if that will be the best option. So I want to ask you guys what I better can use.
Greetings,
Abadi
|
|
|
|
|
I'm not saying that what I am going to suggest is 'better' than DirectX, in terms of smoothness and control DirectX will probably be 'better'.
If you go to the Code Project Home Page and type c# marquee into the search box at the top you will find several 'marquee' controls. Have a look at the code they contain and see if you can use it.
Also on MSDN there is an example Walkthrough: Creating a Windows Forms Control That Takes Advantage of Visual Studio Design-Time Features [^] that includes a marquee control.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
Check the value of xcontrol. If it's never anything other than 0 or 1, then you'll keep calling Lhesaplax and never hit your base case to exit the recursion.
Dybs
The shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen
|
|
|
|
|
Don't delete your message - how rude, after you got the help you needed.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I need to read a file from over 200 pcs on our network using a C# application. This file might not exist so creating it is an easy process--just running a command from the command line on remote pc. I found a tool called psexec which allows running commands on remote pcs: I simply use this tool and run the command. However, it takes very long and I have to keep checking if the file exists. If I run the command on the remote pc right at the remote pc then it is instantaneous.
Is there a better alternative? I simply need to do the following:
1. Check if a file exists and delete it.
2. Recreate the file by running the command on remote pc.
3. Read the file.
I am sure others have had to do this before.
CodingYoshi
Artificial Intelligence is no match for Human Stupidity.
|
|
|
|
|
Hello Every one,
I used this Line to insert a new row in the orders table :
ordersTableAdapter.Insert((int)cmbClients.SelectedValue, DateTime.Today, totalPrice, amntPaid, rest);
I want now to know the PrimaryKey of this inserted row
Thanks in advace
All You Need Is A Good Friend
|
|
|
|
|
Assuming that your Primary Key Column is an Identity column this[^] might give you some ideas. At the very least, some terms to google for.
Good Luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Dear all,
I made a Setup Wizard project in Visual Studio C# and set the "serial number" to true to protect my software; however, if the user input all "7", the serial number will always be valid
I wish after the installation, the software could read the serial number input by the user somewhere from the user's computer so that the software could check the serial number again (by some other algorithm made by me, other than the one that sum and divide by 7).
Any one knows how to do this? I will really appreciated if you could provide me some sample codes.
Thanks a lot!
coco
|
|
|
|
|
|
We have put in 30+ hours of research on this one and are still trying to figure out what the correct development path should be. It's time to ask for some experienced help.
What we need is to create a control that renders predefined 3D models of robots which we can drop onto C# and VB.net forms. The control would expose basic robot control to the form and programmers. For example:
- robotcontrol.arm.joint(2).position = 45
- a form button that toggles wireframe view
- clicking on the control can output 3D coordinates of where the users mouse is for us to incorporate feedback control etc.
We aren't game developers so building a 3D world inside a control from scratch is a rather daunting approach. I have scoured the internet for 3rd party tools that can help build this control and leadwerks is the only thing I've found that's close. I've also found one program that is made for adding 3D CAD viewers to .net applications. It works well, but lacks the ability to create any kind of parent/child relationship between the parts. For every degree of movement on any appendage you have to redraw the entire scene. That is a math and CPU nightmare for complex robots.
I have been learning Blender and we can import our CAD file parts into the program and I'm learning constraints to connect them together. Blender can export as .X directX files. It seems we can model a robot this way, but here's where we get lost. What is the way to bridge having a Blender model and creating a .NET control for it? There doesn't seem to be any examples, tutorials, etc out there for bridging these two worlds.
So I wanted to ask the community how they think this could be best developed. Any sage wisdom on this?
Thanks!
robot_builder
|
|
|
|
|
|
Hello every one,
I have sql server 2005 express edition installed and I created the database using it.I then developed a C# application that connects to this database. Now I want to deploy all of this to a client PC (only 1 client).
does he need to have SQL server installed ?
What steps should I do to deploy ?
Thanks
All You Need Is A Good Friend
|
|
|
|
|
Perhaps this[^] will help
I know the language. I've read a book. - _Madmatt
|
|
|
|