Connection conn = null;
String url = "jdbc:jtds:sqlserver://192.168.1.25:1433/";
String dbName = "Demo;Instance=MSSQLSERVER;";
String userName = "BIT";
String password = "1234";
String driver = "net.sourceforge.jtds.jdbc.Driver";
try {
TextView tv1 = (TextView) findViewById(R.id.textView1);
TextView tv2 = (TextView) findViewById(R.id.textView2);
TextView tv3 = (TextView) findViewById(R.id.textView3);
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
Log.w("Connection","open");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT ItemDesc,Qty,NetPrice FROM TrxDetail ");
String a ="";
String b ="";
String c ="";
while (rs.next())
{
a += rs.getString("ItemDesc");
b += rs.getString("Qty");
c += rs.getString("NetPrice");
}
tv1.setText(a);
tv2.setText(b);
tv3.setText(c);
conn.close();
}
xml:
为什么不是所有的信息。刚刚公布了最终数据。如何显示所有数据。如何编辑 xml 正确。我不知道该问谁。