Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
i believe that this code views the data in the sdf file in a datagrid.

VB
Imports System.Data.SqlServerCe
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim scon As SqlCeConnection = New SqlCeConnection("Data Source=C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Samples\Northwind.sdf")

        Dim ceda As SqlCeDataAdapter = New SqlCeDataAdapter("Select * from Suppliers", scon)

        Dim ds As New DataSet

        ceda.Fill(ds, "MyTable")

        DataGridView1.DataSource = ds.Tables("MyTable").DefaultView

        ' Also you can iterate data from datatable like this:

        'ds.Tables("MyTable").Rows(rowIndex).Item(colIndex).ToString()
    End Sub
End Class



but i need to make an application that opens the sdf file without putting the sdf file in the source code in vb.net
what i mean is when you want to add a database file in your program you add it as an existing item.
what i want is the user can search for the sdf file in his/her directories and the application shows the data in the database.

but i dont know where to start. guys do you have any idea about this?
i want to achieve something like this http://sdf-viewer.software.informer.com/[^]
Posted
Updated 5-Jul-21 5:27am
v3
Comments
TnTinMn 23-Apr-13 21:53pm    
What has you done so far? No one is going to write this application for you.

Here is a hint: First retrieve a table of Tables in the DB. This is accessed using "SELECT * FROM INFORMATION_SCHEMA.TABLES". Then you can retrieve each Table in the DB and display it's contents.
[no name] 23-Apr-13 22:18pm    
i am currently working on it. thanks for the suggestion.
[no name] 23-Apr-13 22:14pm    
Okay so what is wrong with the open file dialog?

1 solution

Wow. This is going to go well.

We already told you about the OpenFileDialog and you still don't know anything about it. This tells us that you're pretty much going to ignore anything we tell you, not teach yourself anything, and anyone but you is going to end up writing the vast majority of this app.

You can't write this app from a bunch of forum posts. You've got no experience to tell you how to design the app (you're NOT going to learn that in forums either!) and don't have a clue about all of the little bits you're going to need to put this together.

For example... Do you know how to get all of the tables in a database using and SQL SELECT statement? How about the columns of a table? Their definitions? Indexes? Key information?

How about how you're going to disaply all of this information? Do you know how you're going to layout your forms? What controls you're going to need? How about maintaining the application and visual state information?

...and that's only what my groggy little brain came up with in about 5 seconds of thinking about that app.
 
Share this answer
 
Comments
[no name] 24-Apr-13 2:18am    
i already said that im working on it. i searched about OpenFileDialog and TnTinMn suggestion.
there's a progress in my work. thanks for the suggestions

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900