none
Not Able to Open .udl file in Windows 7 .

    Question

  • I know how to create udl file with notepad , changed extension .. When I open it now , it shows the  'windows cant open this file' dialog box.

    Why is this happening .?  [ I tried same procedure on other pc , it works there ]

    Info=

    Windows 7 Ulti 32bit

    sql express 2008

    visual studios 2008

    Friday, January 06, 2012 6:15 AM

Answers

  • Thanks Tejas.net for your feedback.

    I'm glad to hear that you has gotten the connection string finally.

    For this issue "Not Able to Open .udl file in Windows 7", you can consider consulting it at Windows 7 IT Pro Forum http://social.technet.microsoft.com/Forums/en-US/category/w7itpro

     

    By the way, we can find various matched Database Connection Strings here http://connectionstrings.com/

     

    And in C#/.Net, we can connect and access MS Access database and SQL Server database like this for your reference.

    Code sample: Display MS Access database table records on DataGridView

    using System.Data.OleDb;
    public class
    Form1

    {
    private void Form1_Load(object sender, System.EventArgs e)

    {
    OleDbConnection con
    = new OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=D:\\myDB.mdb")
    ;
    OleDbCommand cmd = new OleDbCommand("SELECT * FROM Table1", con)
    ;
    con.Open()
    ;
    OleDbDataAdapter myDA = new OleDbDataAdapter(cmd)
    ;
    DataSet myDataSet = new DataSet()
    ;
    myDA.Fill(myDataSet, "MyTable")
    ;
    DataGridView1.DataSource = myDataSet.Tables["MyTable"].DefaultView
    ;
    con.Close()
    ;
    con
    = null;
    }
    }

     

    Code sample: Display SQL Server database table records on DataGridView

     

    using System.Data.SqlClient;
    public class
    Form1

    {

    private void Form1_Load(object sender, System.EventArgs e)

    {
    SqlConnection con
    = new SqlConnection("Data Source=.;Integrated Security=True;AttachDbFilename=D:\\SqlDatabase.mdf")
    ;
    SqlCommand cmd = new SqlCommand("SELECT * FROM AccessPage", con)
    ;
    con.Open()
    ;
    SqlDataAdapter myDA = new SqlDataAdapter(cmd)
    ;
    DataSet myDataSet = new DataSet()
    ;
    myDA.Fill(myDataSet, "MyTable")
    ;
    DataGridView1.DataSource = myDataSet.Tables["MyTable"].DefaultView
    ;
    con.Close()
    ;
    con
    = null;
    }
    }


    Martin Xie [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, January 11, 2012 4:46 AM
    Moderator

All replies

  • Maybe there is something in it, what is not readable for notepad.

    But tell us how is it related to VC# ?

     


    Success
    Cor
    Friday, January 06, 2012 7:37 AM
  • Friday, January 06, 2012 12:30 PM
  • I know how to create udl file with notepad , changed extension .. When I open it now , it shows the  'windows cant open this file' dialog box.

    Why is this happening .?  [ I tried same procedure on other pc , it works there ]


    Welcome to MSDN Forum.

    Please make sure the Microsoft Data Access Components (MDAC) has been installed on the Windows 7 machine, which contains core Data Access components such as the Microsoft SQL Server OLE DB provider and ODBC driver.

    http://www.microsoft.com/download/en/details.aspx?id=5793


    Martin Xie [MSFT]
    MSDN Community Support | Feedback to us
    Monday, January 09, 2012 8:54 AM
    Moderator
  • Thanks for reply . I installed this , it only extracted few files directly , but nothing came up as a setup . And still *.udl does not work . 

    anyways I am generating connection string  in other ways now . . 

     


    • Edited by Tejas.net Tuesday, January 10, 2012 12:09 PM
    Tuesday, January 10, 2012 12:09 PM
  • Thanks Tejas.net for your feedback.

    I'm glad to hear that you has gotten the connection string finally.

    For this issue "Not Able to Open .udl file in Windows 7", you can consider consulting it at Windows 7 IT Pro Forum http://social.technet.microsoft.com/Forums/en-US/category/w7itpro

     

    By the way, we can find various matched Database Connection Strings here http://connectionstrings.com/

     

    And in C#/.Net, we can connect and access MS Access database and SQL Server database like this for your reference.

    Code sample: Display MS Access database table records on DataGridView

    using System.Data.OleDb;
    public class
    Form1

    {
    private void Form1_Load(object sender, System.EventArgs e)

    {
    OleDbConnection con
    = new OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=D:\\myDB.mdb")
    ;
    OleDbCommand cmd = new OleDbCommand("SELECT * FROM Table1", con)
    ;
    con.Open()
    ;
    OleDbDataAdapter myDA = new OleDbDataAdapter(cmd)
    ;
    DataSet myDataSet = new DataSet()
    ;
    myDA.Fill(myDataSet, "MyTable")
    ;
    DataGridView1.DataSource = myDataSet.Tables["MyTable"].DefaultView
    ;
    con.Close()
    ;
    con
    = null;
    }
    }

     

    Code sample: Display SQL Server database table records on DataGridView

     

    using System.Data.SqlClient;
    public class
    Form1

    {

    private void Form1_Load(object sender, System.EventArgs e)

    {
    SqlConnection con
    = new SqlConnection("Data Source=.;Integrated Security=True;AttachDbFilename=D:\\SqlDatabase.mdf")
    ;
    SqlCommand cmd = new SqlCommand("SELECT * FROM AccessPage", con)
    ;
    con.Open()
    ;
    SqlDataAdapter myDA = new SqlDataAdapter(cmd)
    ;
    DataSet myDataSet = new DataSet()
    ;
    myDA.Fill(myDataSet, "MyTable")
    ;
    DataGridView1.DataSource = myDataSet.Tables["MyTable"].DefaultView
    ;
    con.Close()
    ;
    con
    = null;
    }
    }


    Martin Xie [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, January 11, 2012 4:46 AM
    Moderator
  • Ok, thanks :)
    Wednesday, January 11, 2012 6:20 AM