drsvw88664 2011-08-17 00:06
浏览 67
已采纳

将ASP.net代码转换为PHP&mysql [关闭]

i was looking out for something to convert my asp.net code to php & mysql.

I used a website that claimed to be able to convert but it seems to be not so great when it comes to performance.

I don't know how easy or tough it is to do the conversion as I don't have knowledge of either but I learnt a bit of PHP through w3schools and got an example to refer from a php document to do some of my conversion from .net to php.

The thing is that there is a certain bit of code where I'm unable to think where to proceed from there.

if anyone can help me with this? The correct reply could be useful to anybody else referring for a conversion from asp.net to php and mysql. There is no other post that I found for my question on stack overflow.

  1. <WebMethod()> _
  2. Public Function saveBeerPot(ByVal Potdata As XmlElement) As String
  3. Dim PotXml As New XmlDocument
  4. PotXml.LoadXml(Server.HtmlDecode(Potdata.OuterXml))
  5. Dim m_nodelist As XmlNodeList
  6. m_nodelist = PotXml.SelectNodes("/DocumentElement/Table")
  7. Dim status As String = "no data"
  8. Dim _connectionString As String
  9. Dim strSQL As String
  10. Try
  11. _connectionString = ConfigurationManager.ConnectionStrings("AESSYSTEM_DB").ConnectionString
  12. Dim sqldb As New SqlDatabase(_connectionString)
  13. Dim XmlNode = PotXml.FirstChild
  14. Dim xmlNodeT = XmlNode.FirstChild
  15. m_nodelist = xmlNodeT.ChildNodes
  16. If m_nodelist.Count > 0 Then
  17. Dim _pot_id = m_nodelist.Item(0).InnerText
  18. Dim _pot_name = m_nodelist.Item(1).InnerText
  19. Dim _owner_user_id = m_nodelist.Item(2).InnerText
  20. Dim _language_id = m_nodelist.Item(3).InnerText
  21. Dim _currency_id = m_nodelist.Item(4).InnerText
  22. Dim _skin_id = m_nodelist.Item(5).InnerText
  23. Dim _minimum_check = m_nodelist.Item(6).InnerText
  24. Dim _minimum_amount = m_nodelist.Item(7).InnerText.Replace(",", ".")
  25. Dim _pot_fund = m_nodelist.Item(8).InnerText.Replace(",", ".")
  26. Dim _password = m_nodelist.Item(9).InnerText
  27. status += _password
  28. If _minimum_amount.Length = 0 Then
  29. _minimum_amount = "0"
  30. End If
  31. If _pot_id.Length = 0 Then
  32. Dim _pot_guid = generateGuid()
  33. strSQL = "INSERT INTO POT (pot_name, owner_user_id, language_id, currency_id, skin_id, minimum_check, minimum_amount, pot_fund,pot_guid,password,checkout,lastcheckout,autoupdate,created_date,nextautoupdatedate)"
  34. strSQL += " values('" + _pot_name + "', '" +
  35. _owner_user_id + "', '" + _language_id + "', '" + _currency_id + "', '" + _skin_id + "', '" + _minimum_check + "', '" + _minimum_amount + "', '" + _pot_fund + "', '" + _pot_guid + "', '" + _password + "','0','0','8','" + System.DateTime.Today.ToString + "','" + System.DateTime.Today.ToString + "')"
  36. strSQL += "SELECT IDENT_CURRENT('POT');"
  37. _pot_id = sqldb.ExecuteScalar(strSQL, CommandType.Text).ToString()
  38. strSQL = "INSERT INTO PotUsers (pot_id,user_id,current_amount)"
  39. strSQL += "values('" + _pot_id + "','" +
  40. _owner_user_id + "', '0')"
  41. Else
  42. strSQL = "UPDATE POT SET pot_name = '" + _pot_name
  43. + "', language_id = '" + _language_id + "', currency_id = '" +
  44. _currency_id + "', skin_id = '" + _skin_id + "', minimum_check = '" +
  45. _minimum_check + "', minimum_amount = '" + _minimum_amount + "'"
  46. strSQL += " WHERE pot_id = '" + _pot_id + "'"
  47. status += strSQL
  48. End If
  49. sqldb.ExecuteNonQuery(strSQL, CommandType.Text)
  50. status = "inserted"
  51. End If
  52. Return status
  53. Catch ex As Exception
  54. status += ex.Message
  55. Return status
  56. End Try
  57. End Function

展开全部

  • 写回答

1条回答 默认 最新

  • doutui2016 2011-08-17 00:19
    关注

    You won't find a perfect conversion tool from .NET to PHP, it will most probably require some effort on your behalf...

    I think you just need to look at this in separate chunks and break the code down. If you use MSDN and search for things like WebMethod and the other types and methods you are unsure about you should be able to piece it together in PHP in not too much time.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 爱快路由器端口更改错误导致无法访问
  • ¥20 安装catkin时遇到了如下问题请问该如何解决呢
  • ¥15 VAE模型如何输出结果
  • ¥15 编译python程序为pyd文件报错:{"source code string cannot contain null bytes"
  • ¥20 关于#r语言#的问题:广义加行模型拟合曲线后如何求拐点
  • ¥15 fluent设置了自动保存后,会有几个时间点不保存
  • ¥20 激光照射到四象线探测器,通过液晶屏显示X、Y值
  • ¥50 数据库开发问题求解答
  • ¥15 安装anaconda时报错
  • ¥15 小程序有个导出到插件方式,我是在分包下引入的插件,这个export的路径对吗,我看官方文档上写的是相对路径
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部