Click here to Skip to main content
15,891,529 members
Home / Discussions / C#
   

C#

 
GeneralExcel Cell's Date Problem While reading Pin
ksanju100026-May-05 21:13
ksanju100026-May-05 21:13 
GeneralRe: Excel Cell's Date Problem While reading Pin
Maqsood Ahmed27-May-05 0:57
Maqsood Ahmed27-May-05 0:57 
GeneralException in accessing web service Pin
verma-rahul26-May-05 20:30
verma-rahul26-May-05 20:30 
GeneralProbem with a combobox in winforms datagrid Pin
000000726-May-05 19:05
000000726-May-05 19:05 
Questionwhat software do i need to install to run C# Pin
ken617126-May-05 16:35
ken617126-May-05 16:35 
AnswerRe: what software do i need to install to run C# Pin
Christian Graus26-May-05 16:42
protectorChristian Graus26-May-05 16:42 
GeneralC# DirectX Loading multiple .x files Pin
Rinventive26-May-05 14:52
Rinventive26-May-05 14:52 
GeneralInsert with Parameters Pin
NormBohana26-May-05 14:38
NormBohana26-May-05 14:38 
I am kind of stuck on stupid, and need some help. The following code works only once and then I get and error because of multi '@Param' use. I coded it this way because of the need to do some conversions as you can see. Can someone tell me how to code this in the correct way? I am new at this kind of code.

Norm Mad | :mad: Frown | :(

try
{

sqlInsertCommand1.CommandText = "INSERT INTO services([service-code], [service-description] ,[large-animal-cost], [medium-animal-cost], [small-animal-cost])" +
" values(@Param1,@Param2,@Param3, @Param4,@Param5) SELECT @@IDENTITY";

SqlParameter param = sqlInsertCommand1.Parameters.Add("@Param1",SqlDbType.Int);
param.Value = txtServiceCode.Text;

param = sqlInsertCommand1.Parameters.Add("@Param2",SqlDbType.VarChar);
param.Value = txtServiceDesc.Text;

param = sqlInsertCommand1.Parameters.Add("@Param3",SqlDbType.Money);
param.Value = Convert.ToDecimal(cbLargeAnimalCost.Text);

param = sqlInsertCommand1.Parameters.Add("@Param4",SqlDbType.Money);
param.Value = Convert.ToDecimal(cbMediumAnimalCost.Text);

param = sqlInsertCommand1.Parameters.Add("@Param5",SqlDbType.Money);
param.Value = Convert.ToDecimal(cbSmallAnimalCost.Text);

sqlInsertCommand1.Connection = sqlConnection1;
if (sqlConnection1.State != ConnectionState.Open)
sqlConnection1.Open();
sqlInsertCommand1.ExecuteNonQuery();


nbohana
GeneralRe: Insert with Parameters Pin
Christian Graus26-May-05 14:59
protectorChristian Graus26-May-05 14:59 
QuestionHow to Excelsheet data from c# Pin
srinivasr_sankasani26-May-05 13:53
srinivasr_sankasani26-May-05 13:53 
AnswerRe: How to Excelsheet data from c# Pin
pubududilena26-May-05 20:02
pubududilena26-May-05 20:02 
GeneralPassing parameters from aspx to code behind file. Pin
Phillip H. Blanton26-May-05 13:02
Phillip H. Blanton26-May-05 13:02 
GeneralRe: Passing parameters from aspx to code behind file. Pin
Christian Graus26-May-05 14:23
protectorChristian Graus26-May-05 14:23 
GeneralRe: Passing parameters from aspx to code behind file. Pin
Phillip H. Blanton26-May-05 17:48
Phillip H. Blanton26-May-05 17:48 
GeneralRe: Passing parameters from aspx to code behind file. Pin
Christian Graus27-May-05 2:45
protectorChristian Graus27-May-05 2:45 
GeneralRe: Passing parameters from aspx to code behind file. Pin
Phillip H. Blanton27-May-05 3:23
Phillip H. Blanton27-May-05 3:23 
QuestionHow does one know the Screen Point of a MenuItem when it is drawn using OwnerDrawn true? Pin
Don Ashworth26-May-05 11:35
Don Ashworth26-May-05 11:35 
AnswerRe: How does one know the Screen Point of a MenuItem when it is drawn using OwnerDrawn true? Pin
Marc Clifton26-May-05 15:52
mvaMarc Clifton26-May-05 15:52 
GeneralRe: How does one know the Screen Point of a MenuItem when it is drawn using OwnerDrawn true? Pin
Don Ashworth27-May-05 4:09
Don Ashworth27-May-05 4:09 
GeneralRe: How does one know the Screen Point of a MenuItem when it is drawn using OwnerDrawn true? Pin
Marc Clifton27-May-05 6:20
mvaMarc Clifton27-May-05 6:20 
GeneralRe: How does one know the Screen Point of a MenuItem when it is drawn using OwnerDrawn true? Pin
Don Ashworth27-May-05 7:13
Don Ashworth27-May-05 7:13 
GeneralHandling Bad HTTP server responses Pin
crc102426-May-05 11:26
crc102426-May-05 11:26 
GeneralDataTable's ever changing row index Pin
fuzzlog26-May-05 8:15
fuzzlog26-May-05 8:15 
GeneralRe: DataTable's ever changing row index Pin
pubududilena26-May-05 19:55
pubududilena26-May-05 19:55 
GeneralRe: DataTable's ever changing row index Pin
Anonymous26-May-05 20:05
Anonymous26-May-05 20:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.