I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
Nej det er i java, jeg skal have at vide om når man siger rs.substring(1) får fat i den aktuelle string som evt. stammer fra et resultset ELLER om man skal sige f.ek.s. rs.substring(1,1)... Jeg skal have fat i den samme række men flere oplysninger i den række!
You have selected one or more records and one of the fields contains data which you want into your progrem, or is it the GetString method you are thinking of?
// BeginGetStringJ // The WFC class includes the ADO objects. import com.ms.wfc.data.*; import java.io.* ;
public class GetStringX { // The main entry point for the application.
public static void main (String[] args) { GetStringX (); System.exit(0); }
// Declarations. BufferedReader in = new BufferedReader (new InputStreamReader(System.in)); String strCnn = "DSN=Pubs;Provider=MSDASQL;uid=MyUserId;pwd=MyPassword;"; String strOutput;
try { // Get the user input for state. System.out.println( "Enter a state (CA, IN, KS, MD, MI, OR, TN, UT): "); String strState = in.readLine().trim(); String strQuery = "SELECT au_fname, au_lname, address, city FROM Authors " + "WHERE state = '" + strState + "'";
// Open recordset with data from Authors table. cnConn1 = new Connection(); cnConn1.open(strCnn); rstAuthors = new Recordset(); rstAuthors.open(strQuery, cnConn1, AdoEnums.CursorType.STATIC, AdoEnums.LockType.READONLY, AdoEnums.CommandType.TEXT);
if (rstAuthors.getRecordCount() > 0) { // Use all defaults: get all rows, TAB column delimiter, // CARRIAGE RETURN // row delimiter, empty-string null delimiter. strOutput = rstAuthors.getString(AdoEnums.StringFormat.CLIPSTRING, rstAuthors.getRecordCount(), "\t ", "\n", "").trim(); System.out.println("\nState = '" + strState + "'" + "\n\n" + "Name Address City" + "\n"); System.out.println(strOutput); } else System.out.println("\nNo rows found for state = '" + strState + "'\n");
// Cleanup objects before exit. rstAuthors.close(); cnConn1.close();
System.out.println("\nPress <Enter> to continue.."); in.readLine(); } catch( AdoException ae ) { // Notify user of any errors that result from ADO.
// As passing a Recordset, check for null pointer first. if (rstAuthors != null) { PrintProviderError(rstAuthors.getActiveConnection()); } else { System.out.println("Exception: " + ae.getMessage()); } }
// System read requires this catch. catch( java.io.IOException je) { PrintIOError(je); }
}
// PrintProviderError Function
static void PrintProviderError( Connection Cnn1 ) { // Print Provider errors from Connection object. // ErrItem is an item object in the Connection’s Errors collection. com.ms.wfc.data.Error ErrItem = null; long nCount = 0; int i = 0;
nCount = Cnn1.getErrors().getCount();
// If there are any errors in the collection, print them. if( nCount > 0); { // Collection ranges from 0 to nCount - 1 for (i = 0; i< nCount; i++) { ErrItem = Cnn1.getErrors().getItem(i); System.out.println("\t Error number: " + ErrItem.getNumber() + "\t" + ErrItem.getDescription() ); } }
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.