Click here to Skip to main content
15,889,479 members
Home / Discussions / C#
   

C#

 
GeneralRe: Capture and Save Image Pin
Monark23-Sep-08 15:00
Monark23-Sep-08 15:00 
GeneralRe: Capture and Save Image Pin
Harvey Saayman23-Sep-08 23:21
Harvey Saayman23-Sep-08 23:21 
Questionvb vs c# variables in sql query strings [reform my question] Pin
Rafone22-Sep-08 19:34
Rafone22-Sep-08 19:34 
AnswerRe: vb vs c# variables in sql query strings Pin
N a v a n e e t h22-Sep-08 19:57
N a v a n e e t h22-Sep-08 19:57 
AnswerRe: vb vs c# variables in sql query strings Pin
Nirandas22-Sep-08 20:43
Nirandas22-Sep-08 20:43 
GeneralRe: vb vs c# variables in sql query strings Pin
Rafone23-Sep-08 3:33
Rafone23-Sep-08 3:33 
GeneralRe: vb vs c# variables in sql query strings Pin
Nirandas23-Sep-08 4:10
Nirandas23-Sep-08 4:10 
GeneralRe: vb vs c# variables in sql query strings [modified] Pin
Rafone23-Sep-08 4:40
Rafone23-Sep-08 4:40 
here ya go. As I said this all worked fine in VB.net. Here is a typical query string
//
strSQL = "SELECT dbo.tblFloat.PointID AS ID, dbo.tblFloat.UTCDateTime, dbo.tblFloat.ActualValue
FROM dbo.tblFloat
WHERE (dbo.tblFloat.PointID = " + ptID + ")"
it is really just 1 line I have broken it up to make it easer to read.

I have found this in the ms knowledgebase

SqlConnection sqlConn;
SqlCommand sqlCommand;
String sQuery;
sQuery = "INSERT INTO DVD (ID, Type, Name) VALUES (@p1, @p2, @p3)";
SqlParameter p1 = new SqlParameter("@p1", this.txtID.Text);
SqlParameter p2 = new SqlParameter("@p2", this.cmbType.Text);
SqlParameter p3 = new SqlParameter("@p3", this.txtName.Text);
Is this the "new" way of doing this?
Would I add,
SqlParameter p1 = new SqlParameter("@ptID", ptID);
Where ptID is the variable that I am trying to pass.
and use that in my Where clause?

if so is there any where you can point me to get more info on doing this? I have lots of queries in the old VB system that will have to be upgraded along with the upgrade to C#.

thx in advance for any help
Rafone

Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...

<div class="ForumMod">modified on Tuesday, September 23, 2008 12:17 PM</div>
GeneralRe: vb vs c# variables in sql query strings Pin
cpkilekofp24-Sep-08 7:16
cpkilekofp24-Sep-08 7:16 
GeneralRe: vb vs c# variables in sql query strings Pin
Rafone24-Sep-08 10:41
Rafone24-Sep-08 10:41 
QuestionRotation of cube Pin
aurosikhadas22-Sep-08 19:21
aurosikhadas22-Sep-08 19:21 
AnswerRe: Rotation of cube Pin
Roger Alsing22-Sep-08 20:17
Roger Alsing22-Sep-08 20:17 
AnswerRe: Rotation of cube Pin
Harvey Saayman22-Sep-08 20:48
Harvey Saayman22-Sep-08 20:48 
AnswerRe: Rotation of cube Pin
Mark Churchill23-Sep-08 23:09
Mark Churchill23-Sep-08 23:09 
QuestionToolStripStatusLabel gets painted with background color of underlying form Pin
Bliedtke22-Sep-08 18:21
Bliedtke22-Sep-08 18:21 
QuestionUnable to get updated config at app.config? Pin
mimimimilaw22-Sep-08 17:53
mimimimilaw22-Sep-08 17:53 
AnswerRe: Unable to get updated config at app.config? Pin
Harvey Saayman22-Sep-08 20:59
Harvey Saayman22-Sep-08 20:59 
QuestionHow to delete the nth line of a text file? Pin
Crul2322-Sep-08 13:54
Crul2322-Sep-08 13:54 
AnswerRe: How to delete the nth line of a text file? Pin
Bliedtke22-Sep-08 18:26
Bliedtke22-Sep-08 18:26 
AnswerRe: How to delete the nth line of a text file? Pin
PIEBALDconsult22-Sep-08 18:35
mvePIEBALDconsult22-Sep-08 18:35 
GeneralRe: How to delete the nth line of a text file? Pin
Crul2323-Sep-08 4:34
Crul2323-Sep-08 4:34 
GeneralRe: How to delete the nth line of a text file? Pin
cpkilekofp25-Sep-08 10:05
cpkilekofp25-Sep-08 10:05 
QuestionGUI for configuring options in a "Settings" file (beyond the property grid) Pin
blak3r22-Sep-08 10:00
blak3r22-Sep-08 10:00 
QuestionVc++ & .net Application Terminated Unusually Pin
balu1234522-Sep-08 9:13
balu1234522-Sep-08 9:13 
AnswerCross-post Pin
Wendelius23-Sep-08 8:35
mentorWendelius23-Sep-08 8:35 

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.