mardi 6 octobre 2015

can not select Id of a persian value from the microsoft sql server in android

i have MSSQL DB,wich is SQL_Latin1_General_CP1_CI_AS collation and filled out with some persian values, the type of the field stored in DB is String(nvarchar(50), null) I want to get the ID of this String,that is Integer. so i open my Connection and write this in my code :

                ConnectionHelper connectionHelper = new ConnectionHelper();
                statement2 = connectionHelper.getConnection().createStatement();
                setType();
                ResultSet resultSet = statement2.executeQuery("select Id from tblProductCategory where Name='" + getType() + "'");

But i couldnt. getType() return a string in persion from my GridView.

After hours, i insert Latin String in my tblProductCategory and select its ID, and it worked correctly. My problem is with Persian Language. i searched and find that mssql server doesnt have utf-8, but nvarchar support this. any Idea?

Aucun commentaire:

Enregistrer un commentaire