3 Replies - 10456 Views - Last Post: 31 August 2009 - 09:44 PM Rate Topic: -----

#1 poonam.n  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 20-August 09

PreparedStatement in c#

Posted 20 August 2009 - 02:09 AM

Hi,

I am trying to convert a java class to c# . I am stuck with converting PreparedStatement to c# . I do not have much knowledge of java. Can anyone please tell me what would an equivalent to PreparedStatement in c# .. Thanks in advance ..
Is This A Good Question/Topic? 0
  • +

Replies To: PreparedStatement in c#

#2 5thWall  Icon User is offline

  • Occasional Member

Reputation: 31
  • View blog
  • Posts: 530
  • Joined: 17-September 08

Re: PreparedStatement in c#

Posted 20 August 2009 - 09:11 AM

I'm assuming this is for a database. You probably want to look into the SqlCommand class, specifically the SqlParameterCollection it exposes. From there you can use the AddWithValue() to safely add user input to your sql statement.
Was This Post Helpful? 0
  • +
  • -

#3 poonam.n  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 20-August 09

Re: PreparedStatement in c#

Posted 31 August 2009 - 02:04 AM

View Post5thWall, on 20 Aug, 2009 - 08:11 AM, said:

I'm assuming this is for a database. You probably want to look into the SqlCommand class, specifically the SqlParameterCollection it exposes. From there you can use the AddWithValue() to safely add user input to your sql statement.



Thanks a million for ur help .. Worked fine ..
Was This Post Helpful? 0
  • +
  • -

#5 aks29921  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 105
  • View blog
  • Posts: 298
  • Joined: 24-August 09

Re: PreparedStatement in c#

Posted 31 August 2009 - 09:44 PM

preparedstatement is used for parametrized queries
use cmd.Parameters.Add() to add parameters to your query here
where cmd is of the type OledbCommand

This post has been edited by aks29921: 31 August 2009 - 09:50 PM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1