database connection - Error:(73, 5) error: illegal start of expression -
anyone can me? i'm amateur in android programming. that's code:
package com.example.aleta.dbapp; /** * created aleta on 24/07/2017. */ import java.sql.connection; import java.sql.drivermanager; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; import java.util.arraylist; import android.annotation.suppresslint; import android.os.bundle; import android.os.strictmode; import android.support.v7.app.actionbaractivity; import android.util.log; import android.view.view; import android.widget.adapterview; import android.widget.adapterview.onitemselectedlistener; import android.widget.arrayadapter; import android.widget.spinner; import android.widget.toast; public class forspinner{ connection connect; preparedstatement stmt; resultset rs; string srvr,dbn; @override protected void oncreate(bundle saveinstancestate){ super.oncreate(saveinstancestate); setcontentview(r.layout.spinners); srvr="desktop-f27tagv\\aletayeb_db"; db="shop_db"; spinnerstate=(spinner) findviewbyid(r.id.spinnerstate); connect=conn; string query="select title ostan"; connect=conn; stmt=connect.preparestatement(query); rs=stmt.executequery(); arraylist<string> data=new arraylist<string>(); while (rs.next()){ string id=rs.getstring("ostan"); data.add(id); } string[] array=data.toarray(new string[0]); arrayadapter nocoreadapter=new arrayadapter(this,android.r.layout.simple_list_item_1,data); spinnerstate.setadapter(nocoreadapter); spinnerstate.setonitemselectedlistener(new onitemselectedlistener(){ @override public void onitemselected(adapterview<?> adapterview, view view, int position, long id){ string name=spinnerstate.getselecteditem().tostring(); toast.maketext(forspinner.this,name,toast.length_short()).show(); } @override public void onnothingselected(adapterview<?> parent) { } }); @suppresslint("newapi") private connection conn(){ strictmode.threadpolicy policy = new strictmode.threadpolicy.builder().permitall().build(); strictmode.setthreadpolicy((policy)); connection conn=null; string connurl=null; class.forname("net.sourceforge.jtds.jdbc.driver"); connurl="jdbc:jtds:sqlserver://" + srvr + ";" + "databasename=" + dbn + ";integrated security=true;"; conn=drivermanager.getconnection(connurl); return conn; } } }
but error occurred :
error:(73, 28) error: ';' expected error:execution failed task ':app:compiledebugjavawithjavac'. > compilation failed; see compiler error output details. information:build failed information:total time: 2.572 secs information:2 errors information:0 warnings information:see complete output in console
how can solve that?
Comments
Post a Comment