我正在尋找一些東西來將我的asp.net代碼轉換爲php的mysql。將ASP.net代碼轉換爲PHP和mysql
我用了一個網站,聲稱能夠轉換,但它似乎不是很好,當涉及到性能。
我不知道做轉換有多麼容易或者很難,因爲我沒有任何知識,但是我通過w3schools學到了一點PHP,並得到了一個從php文檔引用來做一些例子我從.net轉換爲php。
事情是,有一些代碼,我無法想到從那裏開始。
如果有人可以幫我這個嗎?正確的答覆可能對任何其他人提及從asp.net到php和mysql的轉換有用。沒有其他職位,我發現我的問題堆棧溢出。
<WebMethod()> _
Public Function saveBeerPot(ByVal Potdata As XmlElement) As String
Dim PotXml As New XmlDocument
PotXml.LoadXml(Server.HtmlDecode(Potdata.OuterXml))
Dim m_nodelist As XmlNodeList
m_nodelist = PotXml.SelectNodes("/DocumentElement/Table")
Dim status As String = "no data"
Dim _connectionString As String
Dim strSQL As String
Try
_connectionString = ConfigurationManager.ConnectionStrings("AESSYSTEM_DB").ConnectionString
Dim sqldb As New SqlDatabase(_connectionString)
Dim XmlNode = PotXml.FirstChild
Dim xmlNodeT = XmlNode.FirstChild
m_nodelist = xmlNodeT.ChildNodes
If m_nodelist.Count > 0 Then
Dim _pot_id = m_nodelist.Item(0).InnerText
Dim _pot_name = m_nodelist.Item(1).InnerText
Dim _owner_user_id = m_nodelist.Item(2).InnerText
Dim _language_id = m_nodelist.Item(3).InnerText
Dim _currency_id = m_nodelist.Item(4).InnerText
Dim _skin_id = m_nodelist.Item(5).InnerText
Dim _minimum_check = m_nodelist.Item(6).InnerText
Dim _minimum_amount = m_nodelist.Item(7).InnerText.Replace(",", ".")
Dim _pot_fund = m_nodelist.Item(8).InnerText.Replace(",", ".")
Dim _password = m_nodelist.Item(9).InnerText
status += _password
If _minimum_amount.Length = 0 Then
_minimum_amount = "0"
End If
If _pot_id.Length = 0 Then
Dim _pot_guid = generateGuid()
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)"
strSQL += " values('" + _pot_name + "', '" +
_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 + "')"
strSQL += "SELECT IDENT_CURRENT('POT');"
_pot_id = sqldb.ExecuteScalar(strSQL, CommandType.Text).ToString()
strSQL = "INSERT INTO PotUsers (pot_id,user_id,current_amount)"
strSQL += "values('" + _pot_id + "','" +
_owner_user_id + "', '0')"
Else
strSQL = "UPDATE POT SET pot_name = '" + _pot_name
+ "', language_id = '" + _language_id + "', currency_id = '" +
_currency_id + "', skin_id = '" + _skin_id + "', minimum_check = '" +
_minimum_check + "', minimum_amount = '" + _minimum_amount + "'"
strSQL += " WHERE pot_id = '" + _pot_id + "'"
status += strSQL
End If
sqldb.ExecuteNonQuery(strSQL, CommandType.Text)
status = "inserted"
End If
Return status
Catch ex As Exception
status += ex.Message
Return status
End Try
End Function
爲什麼要轉換爲首先不理解的語言? – Quamis
唯一可以在兩種編程語言之間進行可靠轉換的東西(或者是對於這個問題的口頭或書面的)是人類。 – 2011-08-17 08:10:38
沒辦法。沒有理由轉換。你最好學習.NET,至少你可以節省很多時間來轉換現有的代碼。 – J0HN