开发者

web service vb.net

   Dim j As New SqlDataSource
   Dim xId As String
   Dim y = j.ConnectionString("Data Source=pcname;Initial Catalog=database;Integrate开发者_StackOverflow中文版d Security=True")
   Dim query As String
   query = "SELECT *  FROM x WHERE username =" + Username + " AND Password = " + Password
   Dim result = j.SelectCommand(query)
   xId = j.SelectParameters('xId')
   return xId 

I do no it is right way to return XId field.

A bit confuse since this is first time i touch vb since vb6. Lot of changes.

Software Use : Visual Web Developer 2008 Express. Database Use : Sql Server 2008 Express.


This should give you a starting point of how to use SqlConnection

  • SQL In VB.NET
  • SqlCommand Class

You should also seriously avoid using string concatenation for the Sql Query to avoid SqlInjection. Rather use SqlParameter Class

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜