Solved

convert from vb to c#

Posted on 2006-11-02
3
199 Views
Last Modified: 2010-04-16
I have the following simple vb code.  How to convert to c#?  Thanks.
 
        Dim conn = New OracleConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionString"))
        Dim CMD = New OracleCommand
        Dim da = New OracleClient.OracleDataAdapter(CMD)
        Dim ds = New DataSet

        CMD.Connection = conn
        conn.Open()

        CMD.CommandTEXT = "MY_PROC"

        CMD.Parameters.Add("in_psr_type", OracleType.VarChar)
        CMD.Parameters("in_psr_type").Value = Request.QueryString("in_type")

        CMD.CommandType = CommandType.StoredProcedure

        da.SelectCommand = CMD
        da.Fill(ds, "ContactRequests")

        conn.Close()
0
Comment
Question by:ewang1205
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 17861374
OracleConnection conn = new OracleConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionString"));
OracleCommand CMD = new OracleCommand();
OracleClient.OracleDataAdapter da = new OracleClient.OracleDataAdapter(CMD);
DataSet ds = new DataSet();

CMD.Connection = conn;
conn.Open();

CMD.CommandText = "MY_PROC";

CMD.Parameters.Add("in_psr_type", OracleType.VarChar);
CMD.Parameters["in_psr_type"].Value = Request.Querystring["in_type"];

CMD.CommandType = CommandType.StoredProcedure;

da.SelectCommand = CMD;
da.Fill(ds, "ContactRequests");

conn.Close();
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 17861455
       OracleConnection conn = new OracleConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionString"));
                  OracleCommand CMD = new OracleCommand();
                  OracleDataAdapter da = new OracleDataAdapter(CMD);
                  DataSet ds = new DataSet();

                  CMD.Connection = conn;
                  conn.Open();

                  CMD.CommandText = "MY_PROC";

                  CMD.Parameters.Add("in_psr_type", OracleType.VarChar);
                  CMD.Parameters["in_psr_type"].Value = Request.QueryString("in_type");

                  CMD.CommandType = CommandType.StoredProcedure;

                  da.SelectCommand = CMD;
                  da.Fill(ds, "ContactRequests");

                  conn.Close();
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 17861456
doh!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
A short film showing how OnPage and Connectwise integration works.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now