[主观题]

请找出下面这段程序的错误并修正

Public Function getDataFromDB(ByVal strID As String, ByRef tblDT As DataTable) As Integer

D.im connStr As String = _

System.Configuration.ConfigurationSettings.AppSettings("DBConnectionString")

D.im conn As SqlConnection

D.im ds As New DataSet

D.im iRet As Integer = 0

D.im sqlDA As SqlDataAdapter

D.im sqlComm As SqlCommand

D.im sql As String

If IsNothing(strID) Then

strID = String.Empty

E.nd If

strID = strID.Trim

conn = New SqlConnection(connStr)

Try

conn.Open()

sql = "SELECT * FROM WWJB01 WHERE ID LIKE '%" & strID & "%'"

sqlComm = New SqlCommand(sql, conn)

sqlDA = New SqlDataAdapter

sqlDA.SelectCommand = sqlComm

sqlDA.Fill(ds)

If Not IsNothing(ds) Then

If ds.Tables.Count > 1 Then tblDT = ds.Tables(0).Copy

iRet = ds.Tables(0).Rows.Count

E.nd If

E.nd If

C.atch ex As Exception

Throw ex

F.inally

If Not conn.State = ConnectionState.Closed Then

conn.Close()

conn.Dispose()

E.nd If

E.nd Try

Return iRet

E.nd Function

参考答案与解析:

相关试题

请找出下列程序中错误之处 ______。 #include classA{pri

[单选题]请找出下列程序中错误之处 ______。 include classA{private: intx1;protected: int请找出下列程序中错误之处 ______。#include<iostream.h>class A{private:int x1;protected:int x2;public:int x3;};class B:public A{private:int y1;protected:int y2;public:int y3;void disp(){cout<<x1<<y1<<

  • 查看答案
  • 请指出下面程序中不合理的地方。Class A{public:A(void) :

    [主观题]请指出下面程序中不合理的地方。C.lass A{public:A.(void) : m_nVar2(m_nVar1), m_nVar1(0), m_cVar3(0){m_cVar3 =3;}protected:int m_nVar1;int m_nVar2;const int m_cVar3;};

  • 查看答案
  • 写出下面程序的输出()。public class Test {public st

    [单选题]写出下面程序的输出( )。 public class Test { public static void main (String args[ ]) { iht x=1, y=2; System. out. println ("result="+x+y); System. out. println ("result="+(x+y));A.result=12 result=12B.result=3 result=3C.result=3 result=12D.result=12 result

  • 查看答案
  • 在执行下面这段Java程序时:public class Test {public

    [单选题]在执行下面这段Java程序时: public class Test { public static void main (String[] args) { String s1=args[0]; String s2=args[1]; String s3=args[2]; } }若编译程序后键入命令: java Test one two three,那么变量s1所引用的字符串为( )。A.nullB.testC.oneD.java

  • 查看答案
  • 请阅读下面程序 public class ThreadTest {public

    [单选题]请阅读下面程序 public class ThreadTest { public static void main(String args[]) throws Exception{ int i=0; Hello t=new Hello(); while(true) { System.out.println("Good Moming"+i++); if (i==2 && t.isAlive()) { System. out.println("Main waiting for

  • 查看答案
  • 请阅读下面程序 public class ThreadTest {public

    [单选题]请阅读下面程序 public class ThreadTest { public static void main(String args[]) throws Exception{ int i=0; Hello t=new Hello(); while(true) { System.out.println("Good Moming"+i++); if (i==2 && t.isAlive()) { System. out.println("Main waiting for

  • 查看答案
  • 请阅读下面程序public class Test {public static

    [主观题]请阅读下面程序public class Test {public static void main (String[] args) {int i,j;for (i=1;i<5;i++) {for (j=1;j<=i;j++)system.out.print (i+"X"+j+"="+i*j+" ");System.out.println();}}}程序执行完后,i循环和j循环执行的次数分别是[ ]。

  • 查看答案
  • 请阅读下面程序 public class ThreadTest{public s

    [单选题]请阅读下面程序 public class ThreadTest{ public static void main(String args[]) ( Thread t1=new Thread(new Hello()); Thread t2=new Thread(new Hello()); t1.start(); t2.start(); } } class Hello implements Runnable { int i; public void run() { while(true) { Sys

  • 查看答案
  • 请阅读下面程序 public class ThreadTest{public s

    [单选题]请阅读下面程序 public class ThreadTest{ public static void main(String args[]) ( Thread t1=new Thread(new Hello()); Thread t2=new Thread(new Hello()); t1.start(); t2.start(); } } class Hello implements Runnable { int i; public void run() { while(true) { Sys

  • 查看答案
  • 请找出下面工作许可人应负的安全责任的描述错误()。

    [单选题]请找出下面工作许可人应负的安全责任的描述错误()。A . 正确地和安全地组织工作B . 检修设备与运行设备确已隔断C . 安全措施已完善和正确地执行

  • 查看答案