i'm writing windows 10 desktop app (uwp c#)
i try access database.
i read can't directly, can using wcf
i added wcf service , added code
using system; using system.collections.generic; using system.data; using system.data.sqlclient; using system.linq; using system.runtime.serialization; using system.servicemodel; using system.text; namespace wcftodb { // note: can use "rename" command on "refactor" menu change interface name "iservice1" in both code , config file together. [servicecontract] public interface iservice { [operationcontract] dataset querysql(); } public class service : iservice { /// <summary> /// Запрос данных в testtable /// </summary> /// <returns></returns> sqlconnection sqlcon = new sqlconnection("data source=(local);initial catalog=test;integrated security =sspi;"); public dataset querysql() { try { sqlcon.open(); string strsql = "select title, text testtable"; dataset ds = new dataset(); sqldataadapter sqlda = new sqldataadapter(strsql, sqlcon); sqlda.fill(ds); return ds; } { sqlcon.close(); } } }
my sql database on adress (144.76.133.122
)
where need write adress?
and need have table on bd or no?
Comments
Post a Comment