Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

how can my pocket pc app access Ms sql database?

NedusmileNedusmile Member Posts: 1
Pls help me,
i designed a database with ms sql and intend to access it using a mobile device.but at the moment am using the emulator in Visual studio 2008 professional to test the app but it cant access the database, which is running on my system.Am using vb.net for the coding given below, but sqlException keeps on coming out:

Private Sub mnuLoadSqlServer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuLoadSqlServer.Click
Dim cn As System.Data.SqlClient.SqlConnection
Dim cmd As System.Data.SqlClient.SqlCommand
Dim da As System.Data.SqlClient.SqlDataAdapter

Try
' Establish a connection to the SQL Server database.
cn = New System.Data.SqlClient.SqlConnection("Data Source=CHINEDUMSQLEXPRESS;Initial Catalog=medihealth;Integrated Security=SSPI;User ID=CHINEDUMCHINEDU;Password= ;")
cmd = New System.Data.SqlClient.SqlCommand(txtSelect.Text, cn)
da = New System.Data.SqlClient.SqlDataAdapter(cmd)

' Is this table being added to the DataSet? If not destroy and
' recreate the DataSet.
If Not chkAddToDataSet.Checked Then
ds = Nothing
ds = New System.Data.DataSet
End If
' Add the new table.
Dim dt As DataTable = New System.Data.DataTable(txtTableName.Text)
da.Fill(dt)
ds.Tables.Add(dt)
' Display the DataSet.
DisplayData()

Catch ex As Exception
MessageBox.Show(ex.Message)
Finally


End Try

End Sub

Sub DisplayData()
Dim dt As System.Data.DataTable

' Clear the ComboBox control.
cmbTables.Items.Clear()

' Load the ComboBox with a list of available tables.
For Each dt In ds.Tables
cmbTables.Items.Add(dt.TableName.ToString)
Next

' Finally, trigger the displaying of the first table.
cmbTables.SelectedIndex = 0

End Sub

Note: I've tried to use my ip address as the data source, but cant still get through.

Thanks a lot!
Sign In or Register to comment.