Hello there,
is anyone willing to help me converting some small php snippet to C# or vb.net please?

What do you got so far?

If you are trying to convert and is stuck at something, I'm sure lots of people here would help.

If you just want somebody to do it for you, you should probably be posting at the "Jobs and Resume" section, at "Bussines Exchange".

Yeah i did something but stuck and cant get it... :?

So here is php code:

function getchardata($charname,$opt){
    $char = $this->myfetch($this->myquery("select decode(LimitInfo,'UgCf#@+2YanWe765') FROM basetab_sg where Name = '$charname' "));
    $blob =  $this->strToHex($char[0]);
    if($opt == 'level')     return hexdec(substr($blob,52,2));
    if($opt == 'coin')      return hexdec(substr($blob,26,2).substr($blob,24,2).substr($blob,22,2).substr($blob,20,2));
    if($opt == 'salary')    return hexdec(substr($blob,66,2).substr($blob,64,2).substr($blob,62,2).substr($blob,60,2));
    if($opt == 'credit')    return hexdec(substr($blob,74,2).substr($blob,72,2).substr($blob,70,2).substr($blob,68,2));
    if($opt == 'exp')       return hexdec(substr($blob,44,2).substr($blob,42,2).substr($blob,40,2).substr($blob,38,2).substr($blob,36,2));
}

And this is my vb.net code:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        sqlQuery = ("SELECT decode(LimitInfo,'UgCf#@+2YanWe765') FROM basetab_sg where RoleID = 1")
        dbcomm = New MySqlCommand(sqlQuery, conn)

        dbread = dbcomm.ExecuteReader()

        While dbread.Read()
            Dim Blob As Byte() = dbread(0)
            Dim value As String = System.Text.ASCIIEncoding.ASCII.GetString(Blob)
            TextBox1.Text = StrToHex(value)

        End While
    End Sub

I'm probably not doing at all... So if anyone could take a look on those two codes and give me a hand solving it please?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.