The only thing I can see, there's some error in your SQL. Log your sQuery(SQLException) java.sql.SQLException: Invalid object name 'usersbc'.
Log(SQuery)
Hiding your code and query used is the best way not to get help.Incorrect syntax near 'Squery'.
Again. We do not know anything about how you are connecting to the server. If the connection is successfully or not.I got this error when Webhosting migration the server to new one, before migration there is no error to connect the database an table
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
'Subs in this code module will be accessible from all modules.
Dim Sql1 As JdbcSQL
Dim sIP As String ="//202.67.10.162"
Dim sPort As String =":25000"
Dim SDatabase As String = "DB9766_datamaster"
Dim sUser As String = "DB9766_sunshineedu"
Dim sPassword As String = "*******"
Dim Driver As String = "net.sourceforge.jtds.jdbc.Driver"
Dim SqlServer As String = "jdbc:jtds:sqlserver:"
End Sub
Public Sub Koneksi()
Try
Sql1.InitializeAsync("Sql1", Driver,SqlServer & sIP & sPort & ";Databasename="& SDatabase & ";User=" & sUser & ";password=" & sPassword & ";appname=SKMJL;wsid=TEST;loginTimeout=10;sockettimeout=10","","")
ProgressDialogShow("Trying to Connect")
Catch
Log("Connection error")
Log(LastException.message)
Return
End Try
End Sub
#Region Project Attributes
#ApplicationLabel: Beads Card
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#BridgeLogger : true
#Additionaljar: jtds-1.3.1.jar
#End Region
#Region Activity Attributes
#FullScreen: True
#IncludeTitle: false
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
'Private xui As XUI
Public Registration As String
Public dataIP As String
Public nama, phoneid As String
Dim pID As Phone
Dim imei As String
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private Button1 As Button
Private EditText1 As EditText
Private Button2 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
'imei = pID.GetDeviceId
'Activity.SetBackgroundImage(LoadBitmapSample(File.DirAssets, "Backmain.jpg", 1920, 1080))
If FirstTime = True Then
modkoneksi.Koneksi
DisableStrictMode
End If
End Sub
public Sub sql1_ready(success As Boolean)
Try
ProgressDialogHide
Log(success)
If success = False Then
Log("connection Failed")
MsgboxAsync("connection Failed" & CRLF & LastException,"")
Log(LastException)
Return
End If
Catch
Log(LastException)
End Try
End Sub
Sub DisableStrictMode
Dim jo As JavaObject
jo.InitializeStatic("android.os.Build.VERSION")
If jo.GetField("SDK_INT") > 9 Then
Dim policy As JavaObject
policy = policy.InitializeNewInstance("android.os.StrictMode.ThreadPolicy.Builder", Null)
policy = policy.RunMethodJO("permitAll", Null).RunMethodJO("build", Null)
Dim sm As JavaObject
sm.InitializeStatic("android.os.StrictMode").RunMethod("setThreadPolicy", Array(policy))
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub InjectionSafe(input As String) As Boolean
If _
input.Contains(" ") _
Or input.Contains(";") _
Or input.Contains("'") _
Or input.Contains(Chr(0x0022)) _
Or input.Contains(Chr(0x0027)) _
Or input.Contains(Chr(0x00AB)) _
Or input.Contains(Chr(0x00BB)) _
Or input.Contains(Chr(0x2018)) _
Or input.Contains(Chr(0x2019)) _
Or input.Contains(Chr(0x201A)) _
Or input.Contains(Chr(0x201B)) _
Or input.Contains(Chr(0x201C)) _
Or input.Contains(Chr(0x201D)) _
Or input.Contains(Chr(0x201E)) _
Or input.Contains(Chr(0x201F)) _
Or input.Contains(Chr(0x2039)) _
Or input.Contains(Chr(0x203A)) _
Or input.Contains(Chr(0x300C)) _
Or input.Contains(Chr(0x300D)) _
Or input.Contains(Chr(0x300E)) _
Or input.Contains(Chr(0x300F)) _
Or input.Contains(Chr(0x301D)) _
Or input.Contains(Chr(0x301E)) _
Or input.Contains(Chr(0x301F)) _
Or input.Contains(Chr(0xFE41)) _
Or input.Contains(Chr(0xFE42)) _
Or input.Contains(Chr(0xFE43)) _
Or input.Contains(Chr(0xFE44)) _
Or input.Contains(Chr(0xFF02)) _
Or input.Contains(Chr(0xFF07)) _
Or input.Contains(Chr(0xFF62)) _
Or input.Contains(Chr(0xFF63)) _
Then
Return False
Else
Return True
End If
End Sub
Private Sub Button1_Click
Try
Dim i As Int
Registration = EditText1.text
InjectionSafe(EditText1.Text)
Dim sQuery As String = "SELECT COUNT(*) FROM usersbc WHERE username ='" & EditText1.Text & "' AND akses = 'True'"
i = modkoneksi.Sql1.ExecQuerySingleResult(sQuery)
If i <> 0 Then
tampildata
' StartActivity(Home)
Else
MsgboxAsync("Login Gagal, Hubungi Developer untuk ijin penggunaan","Pemberitahuan")
Return
End If
Catch
Log(LastException)
End Try
End Sub
Public Sub tampildata
Dim cursor As JdbcResultSet
imei = pID.getSettings("android_id")
cursor = modkoneksi.Sql1.ExecQuery2("SELECT * FROM usersbc WHERE username = ?",Array(EditText1.Text))
Do While cursor.NextRow
nama = cursor.GetString("name")
phoneid = cursor.GetString("phoneid")
Loop
If phoneid = Null Then
modkoneksi.Sql1.ExecNonQuery("UPDATE usersbc SET phoneid = '"& imei & "' WHERE username = '" & EditText1.Text & "'")
else if phoneid = imei Then
StartActivity(Home)
Else
MsgboxAsync("Login Gagal, Hubungi Developer untuk ijin penggunaan","Pemberitahuan")
Return
End If
End Sub
Private Sub Button2_Click
imei = pID.getSettings("android_id")
'Msgbox(imei,"info")
tampildata
If phoneid = Null Then
modkoneksi.Sql1.ExecNonQuery("UPDATE usersbc SET phoneid = '" & imei & "' WHERE username = '" & EditText1.Text & "'")
End If
End Sub
You are not checking if the connection is successfully!?Sql1.InitializeAsync("Sql1", Driver,SqlServer & sIP & sPort & ";Databasename="& SDatabase & ";User=" & sUser & ";password=" & sPassword & ";appname=SKMJL;wsid=TEST;loginTimeout=10;sockettimeout=10","","")
Sql1.InitializeAsync("Sql1", Driver,SqlServer & sIP & sPort & ";Databasename="& SDatabase & ";User=" & sUser & ";password=" & sPassword & ";appname=SKMJL;wsid=TEST;loginTimeout=10;sockettimeout=10","","")
Wait For Sql1_Ready (Success As Boolean)
If Success Then
log("Databaseconnection successfully")
else
log("Problem connecting to the Database")
end if
public Sub sql1_ready(success As Boolean)
Try
ProgressDialogHide
Log(success)
If success = False Then
Log("connection Failed")
MsgboxAsync("connection Failed" & CRLF & LastException,"")
Log(LastException)
Return
End If
Catch
Log(LastException)
End Try
End Sub
No need to apologizeI'm Sorry Mr Josejad
You must execute it in B4A, in the line 134, and check the logs screen in the B4A IDE, then get the result and paste in navicat, but, as DonManfred says, probably the problem is that your not getting a successful connection to the DBI try to execute log(Squery) in Navicat and the result is
Maybe they don't have the 25000 port open, or they have not given permission to connect externallyI got this error when Webhosting migration the server to new one
Private Sub Button1_Click
Try
Dim i As Int
Registration = EditText1.text
InjectionSafe(EditText1.Text)
Dim sQuery As String = "SELECT COUNT(*) FROM usersbc WHERE username ='" & EditText1.Text & "' AND akses = 'True'"
Log(sQuery)
i = modkoneksi.Sql1.ExecQuerySingleResult(sQuery)
If i <> 0 Then
tampildata
' StartActivity(Home)
Else
MsgboxAsync("Login Gagal, Hubungi Developer untuk ijin penggunaan","Pemberitahuan")
Return
End If
Catch
Log(LastException)
End Try
End Sub
SELECT * FROM [DB9766_sunshineedu].[usersbc] WHERE username = 'adm001' AND akses = 'True'
You can not use the code in a CODE-Module! Codemodules can not handle any events.modkoneksi - 18: Static code modules cannot handle events.
As said above, try:java.lang.NumberFormatException: For input string:
SQL.ExecNonQuery2("SELECT * FROM [DB9766_sunshineedu].[usersbc] WHERE username = ? AND akses = ?", Array(EditText1.Text, True))
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?