Click here to Skip to main content
15,892,537 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionConnecting SQL server 2008 to Visual studio 2008 Pin
MahaKh3-Mar-11 19:02
MahaKh3-Mar-11 19:02 
AnswerRe: Connecting SQL server 2008 to Visual studio 2008 PinPopular
Roger Wright3-Mar-11 19:47
professionalRoger Wright3-Mar-11 19:47 
GeneralRe: Connecting SQL server 2008 to Visual studio 2008 Pin
PIEBALDconsult4-Mar-11 10:28
mvePIEBALDconsult4-Mar-11 10:28 
GeneralRe: Connecting SQL server 2008 to Visual studio 2008 Pin
Roger Wright4-Mar-11 14:54
professionalRoger Wright4-Mar-11 14:54 
AnswerRe: Connecting SQL server 2008 to Visual studio 2008 Pin
PIEBALDconsult4-Mar-11 10:21
mvePIEBALDconsult4-Mar-11 10:21 
AnswerRe: Connecting SQL server 2008 to Visual studio 2008 Pin
Eddy Vluggen4-Mar-11 12:53
professionalEddy Vluggen4-Mar-11 12:53 
GeneralRe: Connecting SQL server 2008 to Visual studio 2008 Pin
MahaKh6-Mar-11 21:13
MahaKh6-Mar-11 21:13 
GeneralRe: Connecting SQL server 2008 to Visual studio 2008 Pin
Eddy Vluggen7-Mar-11 7:25
professionalEddy Vluggen7-Mar-11 7:25 
MahaKh wrote:
but my requirement is to use OLEDB instead of ODBC

The requirement should state that you should use a SqlConnection. Anyway, the difference between the code is relatively subtle;
C#
using (OleDbConnection con = new OleDbConnection(
    "Provider=SQLNCLI;Server=.;Database=AdventureWorks;Trusted_Connection=yes;"))
using (OleDbCommand cmd = con.CreateCommand())
{
    con.Open();
    cmd.CommandText = @"
             SELECT FirstName  
               FROM Person.Contact 
              WHERE ContactID = 20";

    string result = (string)cmd.ExecuteScalar();

    MessageBox.Show(String.Format(
        "The FirstName of Person.Contact is '{0}'.", 
        result
    ));
}
Code tested and verified on W7, .NET 2.0, SQL2k5
I are Troll Suspicious | :suss:

QuestionNon static class with only static methods Pin
DaveyM691-Mar-11 22:41
professionalDaveyM691-Mar-11 22:41 
AnswerRe: Non static class with only static methods Pin
musefan1-Mar-11 22:51
musefan1-Mar-11 22:51 
GeneralRe: Non static class with only static methods Pin
Nitin Singh India21-Mar-11 7:03
Nitin Singh India21-Mar-11 7:03 
GeneralRe: Non static class with only static methods Pin
musefan21-Mar-11 7:14
musefan21-Mar-11 7:14 
AnswerRe: Non static class with only static methods Pin
PIEBALDconsult2-Mar-11 2:11
mvePIEBALDconsult2-Mar-11 2:11 
GeneralRe: Non static class with only static methods Pin
Gregory Gadow4-Mar-11 4:08
Gregory Gadow4-Mar-11 4:08 
GeneralRe: Non static class with only static methods Pin
PIEBALDconsult4-Mar-11 10:17
mvePIEBALDconsult4-Mar-11 10:17 
AnswerRe: Non static class with only static methods Pin
Bernhard Hiller2-Mar-11 3:01
Bernhard Hiller2-Mar-11 3:01 
AnswerRe: Non static class with only static methods Pin
Gregory Gadow4-Mar-11 4:06
Gregory Gadow4-Mar-11 4:06 
GeneralRe: Non static class with only static methods Pin
Karthik. A4-Mar-11 4:16
Karthik. A4-Mar-11 4:16 
GeneralRe: Non static class with only static methods Pin
Gregory Gadow4-Mar-11 6:53
Gregory Gadow4-Mar-11 6:53 
GeneralRe: Non static class with only static methods Pin
Karthik. A4-Mar-11 7:54
Karthik. A4-Mar-11 7:54 
AnswerRe: Non static class with only static methods Pin
Karthik. A4-Mar-11 4:14
Karthik. A4-Mar-11 4:14 
QuestionUrl Image Path in WPF Pin
Pranit Kothari1-Mar-11 8:03
Pranit Kothari1-Mar-11 8:03 
AnswerRe: Url Image Path in WPF Pin
Pete O'Hanlon1-Mar-11 8:54
mvePete O'Hanlon1-Mar-11 8:54 
AnswerRe: Url Image Path in WPF Pin
Pete O'Hanlon1-Mar-11 9:25
mvePete O'Hanlon1-Mar-11 9:25 
QuestionNot able to see my yesterday's question and replies Pin
sr15928-Feb-11 19:46
sr15928-Feb-11 19:46 

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.