paulthepaddy
Well-known member
hey guys took me a while figuring this out but finally got a web service half going, i can access a database on the server side but i cant quite figurre out how ot read it on client side.
Server Side
so far i have played around with this bit of code adding and taking bits in and out, but i just cant figure it out
if anyone can tell me how to display the data onto a datagrid after sending the data adapter back to the client, it would help alot
Server Side
VB.NET:
Public Class Image
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function GetRecords()
Dim con As New OleDb.OleDbConnection
con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\invoices.accdb"
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
con.Open()
da = New OleDb.OleDbDataAdapter("SELECT * FROM Invoices", con)
da.Fill(ds, "Invoices")
con.Close()
Return da
End Function
<WebMethod()> _
Public Sub NewRecord(Invoice_Name As String, customer_Name As String, Total_Total As Integer)
Dim con As New OleDb.OleDbConnection
con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\invoices.accdb"
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
con.Open()
da = New OleDb.OleDbDataAdapter("SELECT * FROM Invoices", con)
da.Fill(ds, "Invoices")
Dim cb As New OleDb.OleDbCommandBuilder(da)
cb.QuotePrefix = "["
cb.QuoteSuffix = "]"
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("Invoices").NewRow()
dsNewRow.Item("Invoice Number") = Invoice_Name
dsNewRow.Item("Date") = Format(System.DateTime.Today, "dd/MM/yy")
dsNewRow.Item("Customer") = customer_Name
dsNewRow.Item("Amount") = Total_Total
dsNewRow.Item("Paid") = False
ds.Tables("Invoices").Rows.Add(dsNewRow)
da.Update(ds, "Invoices")
con.Close()
End Sub
so far i have played around with this bit of code adding and taking bits in and out, but i just cant figure it out
VB.NET:
Dim ws As New localhost.Service1
Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter()
Dim ds As DataSet
da = ws.GetRecords
Me.InvoicesTableAdapter.Fill(da)
if anyone can tell me how to display the data onto a datagrid after sending the data adapter back to the client, it would help alot