Android Question data are not stored in database

Vivek Bhatt

Member
Licensed User
when i click on register button then data can not stored in database. i create databse with help of b4a forums members Thank You.
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Vivek Bhatt

Member
Licensed User
below code of my first App. Program Run Successfully but when i insert data after i click on login button then data can not soterd in database file.

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.

Dim btnlogin As Button
Dim unametxt As EditText
Dim passtxt As EditText
Public idtxt As EditText

End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then
Starter.sql1.Close
End If
End Sub



Sub unametxt_TextChanged (Old As String, New As String)

End Sub

Sub passtxt_TextChanged (Old As String, New As String)

End Sub


Public Sub AddEntry(id As Int , Name As String,Password As String)
Private query As String
Private cursor1 As Cursor
Private id As Int
Private cnt1 As Int=0

query="Select Count(*) FROM data"
cnt1= Starter.sql1.ExecQuerySingleResult(query)
cnt1 = cnt1 + 1
query = "SELECT * FROM data where id = "&id&" AND Name = "&Name&" AND Password = "&Password&" "
'cursor1 = sql1.ExecQuery2(query,Array As String(unametxt.Text,passtxt.Text))
cursor1= Starter.sql1.ExecQuery(query)

If cursor1.RowCount>0 Then
ToastMessageShow("This Entry is Already Exist", False)
Else
query = "INSERT INTO data VALUES (?, ?, ?)"
Starter.sql1.ExecNonQuery2(query, Array As String(cnt1,unametxt.text,passtxt.text))
ToastMessageShow("Entery Added", False)
id = Starter.sql1.ExecQuerySingleResult("SELECT max(id) from data")
idtxt.Text=id
'RowNumber = RowNumber + 1
End If
cursor1.Close

End Sub

Than You.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
@Vivek Bhatt :

Please follow my private message I've sent you some days ago. It's very easy to get help here :)

- tell what your expect/want (example "I need to insert a row but I get THIS error")
- do not just post "it does not work". It's like "my car does not start - what is the problem?"
- post the non working code (with code tags!)
- post the error from the logs
 
  • Like
Reactions: eps
Upvote 0

Vivek Bhatt

Member
Licensed User
I run my program and input data after that when i Click on Submit Button then i Show this Error.
i try to solve this problem but its not solved.

Copying updated assets files (2)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
An error occurred:
(Line: 0) End Sub
java.lang.Exception: Sub btnlogin_click signature does not match expected signature.
public static anywheresoftware.b4a.pc.RemoteObject b4a.example.main_subs_0._btnlogin_click(anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception
No parameters
 
Upvote 0
Top