A Web Service To Add Records to A MySQL Server

wan11

Newcomer
Joined
Jul 26, 2004
Messages
3
Hi there...I have this problem with creating my first web service...I need to create a vb.net web service to add records to my sql server database... So can anyone here lend me a helping hand and give an example coding of the above problem...
Thanks..
:(
 
Last edited:
I have an Oracle example. SQL Server is similar. this one uses a stored proc but you could also use SQL strings if you prefer. Then you wouldn't need parameters just do something like :
INSERT INTO myTable (ID, string) VALUES (3,'parameter passed to web method')


Code:
 <WebMethod(Description:="Paramter: aPath.")> _
    Function ClearF(ByVal apath As String) As String
        Dim Fert As String = String.Empty
        Dim objCmd As New OracleCommand(Fert, OracleConn)
        Dim P_PATH As New OracleParameter
        Try
            OracleConn.Open()
            With objCmd
                .CommandType = CommandType.StoredProcedure
                .CommandText = "USP_FRES"
                .Parameters.Add(P_PATH)
            End With

            'Create Parameter
            P_PATH.ParameterName = "P_PATH"
            P_PATH.DbType = DbType.String
            P_PATH.Direction = ParameterDirection.Input
            P_PATH.Value = apath

            objCmd.ExecuteNonQuery()
            Return "Success"
        Catch ex As Exception
            Return "Error : " & ex.Message
        Finally
            OracleConn.Close()
        End Try
    End Function


Hope this helps.
 
Thank you very much..Now i have 1 more question to ask...How can u create a login web service and the login information is in the database...? They have to register before they could go into my system...And their id and password are stored in the database...so could show me the coding in sql server..
thanks
 
Back
Top