I Create a Ms sql server database called MyDBs and try to made it as movable, attachement database by do this way in Microsoft SQL Server Management:
Script database as - CREATE TO - File
I took the file Of DataBase(MyDBs) and put it in Debug folder in my project.
and try this code to load the data from database:
and it showed me this error: The type initializer for 'OOP__CreatProject.Module4' threw an exception.
Imports System.Data.SqlClient

vb Code:
  1. Module Module4
  2.     Dim MyConnection As SqlConnection = New SqlConnection("Provider=SQLOLEDB.1; " & "Data Source=" & Application.StartupPath & "\MyDBs.sql")
  3.     Public Sub Load_DBmsqldata()
  4.         Dim sql As String = " Select Name,Tel,Addr from Table1 "
  5.         Dim dp As New SqlDataAdapter(sql, MyConnection)
  6.  
  7.         Dim Table1 As New DataTable
  8.         dp.Fill(Table1)
  9.         Form1.DataGridView1.DataSource = Table1
  10.     End Sub
  11.  
  12. End Module