wan11 Posted July 26, 2004 Posted July 26, 2004 (edited) 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.. :( Edited July 26, 2004 by wan11 Quote
VBAHole22 Posted July 26, 2004 Posted July 26, 2004 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') <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. Quote Wanna-Be C# Superstar
wan11 Posted July 27, 2004 Author Posted July 27, 2004 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.