数组倒置的递归算法 不知道哪出错了

public class ReverseArray {
public static void main(String[] args) {
//定义数组
int a[] = {2,3,4,5,6};

    reverse(a,0,a.length-1);
    //遍历输出
    for(int i = 0;i < a.length;i++) {
        System.out.print(a[i]);
    }
}
//做递归
public static void reverse(int a[],int i,int j) {
    if(j > i) {
        Swap(a,a[i],a[j]);
        reverse(a,i+1,j-1);
    }
}
//数组中两个数交换
private static void Swap(int a[],int l,int k) {
    // TODO Auto-generated method stub
        int temp = a[l];
        a[l] = a[k];
        a[k] = temp;

}

}

输出 数组越界 望大家教教

2个回答

Swap 的第二和第三个参数,需要下标,但上面代码中传入的是成员,这样会导致访问越界。

//做递归** 应该是按下标啊,也不是 ,a[i],a[j]**。
public static void reverse(int a[],int i,int j) {
if(j > i) {
Swap(a,a[i],a[j]);
reverse(a,i+1,j-1);
}
}

91program
91program 回复91program: 实在不好意思,两次搞错了。Swap 的第二和第三个参数,需要下标,但上面代码中传入的是成员,这样会导致访问越界。
3 年多之前 回复
91program
91program 不好意思,搞错了。Swap 交换,需要使用指针,而不是元素。否则,形表交换了,但实参并没有交换。
3 年多之前 回复
qq_30151545
无清 想问下要怎么改
3 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
不知道哪出错了
[color=#FF0000]JS:[/color]rnrnString.prototype.format = function() rn var s = this; rn for (var i=0,j=arguments.length; i 2)?arguments[2]:365,rn path = (arguments.length > 3)?arguments[3]:"/";rn with(new Date())rn setDate(getDate()+days);rn days=toUTCString();rn rn document.cookie = "0=1;expires=2;path=3".format(name, value, days, path);rn ,rn Get : function ()rn var returnValue=document.cookie.match(new RegExp("[\b\^;]?" + arguments[0] + "=([^;]*)(?=;|\b|$)","i"));rn return returnValue?unescape(returnValue[1]):returnValue;rn ,rn Delete : function ()rn var name=arguments[0];rn document.cookie = name + "=1 ; expires=Fri, 31 Dec 1900 23:59:59 GMT;";rn rnrnrnvar stTransform = function(s2t)rn var s="万与.......";rn var t="萬與.......";rn s2t = !!s2t || false;rn Cookie.Set("l",s2t?"t":"s");rn var stt = function(str)rn var r = "",i,j,k,c;rn for (i=0,j=str.length; i-1)rn return;rn if(o.title)rn o.title = stt(o.title);rn if(o.alt)rn o.alt = stt(o.alt);rn if(o.tagName && o.type && o.tagName.toUpperCase()=="INPUT" && ",button,submit,reset,".indexOf(o.type.toLowerCase())>-1)rn o.value = stt(o.value);rn for (var i=0,j=o.childNodes.length; i繁体rn[color=#FF0000]rn问题是只能变为繁体,无法变回到简体[/color]
不知道哪出错了?
用结构实现对学生的管理rn#includern#includern#includern#includernstruct Studentrnrn int sid;rn std::string name;rn double score;rn int rank;rn;rnviod printInfo( const Student & s)rnstd::cout<b.score;rnrnvoid put(int &i,char*s="",double &d)rnstd::cout<<"请分别输入学号,姓名,成绩"<>i>>s>>d;rnid=i;rnstrcpy(name,s);rnscore=d;rnrnint main()rnrn int N=5;rn Student s[];rn std::listls;rn for (i=0;i!=n;++i)rn ls.push_back(s[i]);rn ls.sort( compByScore);rn typedef std::list::itrator StudIter;rn for ( StudIter iter=ls.begin();iter!=ls.end();++iter)rn iter->rank=std::distance(ls.begin(),iter)+1;rn std::cout<<"after sort:"< pr;rn for(StudIter iter=ls.begin();iter!=ls.end();++iter)rn rn pr=std::equal_range(iter,ls.end(),*iter,compByScore);rn for(StudIter iter2=pr.first;iter2!=pr.second;++iter2)rn iter2->rank=iter->rank;rn rn std::cout<<"after reRank:"<
模糊PID不知道哪出错了-Desktop.zip
模糊PID不知道哪出错了-Desktop.zip 请教大神帮忙给看看
猴子选大王 不知道哪出错了
//单链表类型及其基本操作函数的定义rn#define OK 1rn#define ERROR 0rn#define OVERFLOW -2rn#define TRUE 1rn#define FALSE 0rntypedef int Status;rn#define OVERFLOW -2rn#define TRUE 1rn#include rn#include rn#include rntypedef int LElemType;rntypedef struct Lnodern LElemType data;rn struct Lnode *next;rn *LinkedList; //LinkedList为单链表类型rnrnvoid CreatList_l(LinkedList &L, int n) //正序创建单链表rn LinkedList p,q;rn int i;rn L=q=(LinkedList)malloc(sizeof(struct Lnode));rn L->data=1; rn for(i=2;i<=n;i++)rn rn q->next=(LinkedList)malloc(sizeof(struct Lnode));rn q->data=i; rn q=q->next;rn rn q->next=L;rnrnrn//循环单链表类型及其基本操作函数的定义rnLElemType Count(LinkedList &L,int m,int n)rnrn int i,j;rn LinkedList p,q;rn p=L;rn q=p->next;rn for(j=1;j<=m-1;j++)rn rn for(i=1;i<=n-2;i++)rn rn p=p->next;rn q=q->next;rn rn p->next=q->next;rn p=q->next;rn free(q);rn q=p->next; rn rn return(p->data); rn rnint main()rn rn int n,m;rn int king; rn LinkedList L;rn LElemType data;rn printf("请输入猴子的数目m:"); scanf("%d",&m);rn printf("输入整数n:"); scanf("%d",&n);rn CreatList_l(L,m);rn king=Count(L,m,n);rn printf("猴子大王是:%d!\n",king);rn system("pause");rn return 0;rnrnrnrnrn测试的时候 输入m = 3 ;n = 2rn会出现溢出rn应该在哪个地方怎么修改rn请高人指点
一个简单的问题,不知道哪出错了
以前都是做java的,没碰到过这种问题,就是一般c++中声明定义放.h中,实现在.cpp。但是我自己做了如下实验却不行rnrntmp.h:rnclass tstClsrnrn public:rn void myDisplay();rnrnrntmp.cpp:rn#include "tmp.h"rnrnvoid tstCls::myDisplay()rnrn cout<<"asdadasd"<
一个题目,不知道哪出错了,见鬼!!!
http://acm.tju.edu.cn/toj/showp2819.htmlrnrnrnrn以下是我写的代码,用提供的数据验算没有错,但是提交的时候就wa,麻烦高手指点指点!!!!rnrnrnrn#includernrnusing namespace std;rnrnint path[1001][1001];rnint main()rnrn int i,j,k,h;rn rn int n;rn cin>>n;rn rn int S,T;rn int N,M;rn for(i=1;i<=n;i++)rn rn rn rn cin>>N>>M;rn for(k=1;k<=1000;k++)rn rn for(j=1;j<=1000;j++)rn rn path[k][j]=-1;rn rn rn rn cin>>S>>T;rn for(j=1;j<=M;j++)rn rn int a,b,length;rn cin>>a>>b>>length;rn path[a][b]=length;rn path[b][a]=length;rn rn for(h=1;h<=N;h++)rn rn if(h==S||h==T) continue;rn if(path[S][h]!=-1&&path[h][T]!=-1&&(path[S][h]+path[h][T]
jsp页面出现乱码,不知道哪出错了?
<%@ page language="java" contentType="text/html; charset=GB18030"rn pageEncoding="GB18030"%>rn<%@ page import="com.weiweiqin.*" %> rn<%@ include file="_sessioncheck.jsp" %> rn <% rn request.setCharacterEncoding("GB18030");rn String name=request.getParameter("name");rn out.println(name);//name出现乱码rn %>rnrnrnrn rn Insert title herernrnrn rn //输入框rnrnrnrnrnrn在输入框中输入“你好”rnString name=request.getParameter("name");rnout.println(name);//name出现乱码且输出为ÄãºÃ rnrnrn
急死了不知道是哪出错了...
我用的是ACCESS数据库3张表分别是Employe,Department,Comany ,vs2005在做个员工管理的系统第一次用,看Scott Mitchell的ASP.NET2.0数据指南这个书,在2005里面创建强类型的DataSet和Table Adapterrn写上了个SQL语句rnrnSELECT [Employe_ID], [Employe_Name], [Department_ID], [Employe_Position], rn [Employe_Email], [Employe_Mobile], [Employe_Phone], [Employe__QQ], rn [Employe_MSN], [Employe_State],rn (SELECT Department_Namern FROM Departmentrn WHERE Department.Department_ID = Employe.Department_ID) rn AS Department_NamernFROM Employern提示说SELECT 子句错误: “SELECT”附近的表达式。rnSELECT 子句错误: “FROM”附近的表达式。rn缺少 FROM 子句。rn无法分析查询文本。rnrn我要是在在下面加个SELECT [Employe_ID], [Employe_Name], [Department_ID], [Employe_Position], rn [Employe_Email], [Employe_Mobile], [Employe_Phone], [Employe__QQ], rn [Employe_MSN], [Employe_State],rn (SELECT Department_Namern FROM Departmentrn WHERE Department.Department_ID = Employe.Department_ID) rn AS Department_NamernFROM Employernwhere Department_ID=@Department_IDrn他就会说至少有一个变量未被指定值rnrnrn请问这是怎么回事啊...,,,,,我急.......急死了rn
哪出错了?
编程将下列矩阵中的元素向右移动一列,最右一列移至第一列。rn1 4 6rn8 10 12rnrn#include rnvoid main()rnrn int v[2][4]=1,4,6,8,10,12,i,j;rn for(i=0;i<=1;i++)rn rn for(j=0;j<=2;j++)rn rn a[i][j+1]=a[i][j];rn rn rn for(i=0;i<=1;i++)rn rn a[i][0]=a[i][3];rn rn for(i=0;i<=1;i++)rn rn for(j=0;j<=3;j++)rn rn printf("%d",a[i][j]);rn printf("\n");rn rn rnrn
归并排序,哪出错了?
[code=Java]rnclass DArrayrn public void mergeSort(int[] arr,int left,int right)rn if(left
谁知道哪出错了?
#include rn#include rn//using std::bad_alloc;rnrnint main()rnrn double *ptr[50];rnrn tryrn for(int i=0;i<50;i++)rn rn ptr[i]=new double[5000000];rn cout<<"allocated 5000000 doubles in ptr["<
access,哪出错了???
出错提示:rnMicrosoft OLE DB Provider for ODBC Drivers (0x80004005)rn[Microsoft][ODBC Microsoft Access Driver] 不能更新。数据库或对象为只读。rn为什么??
哪出错了?
错误类型:rnMicrosoft VBScript 编译器错误 (0x800A0401)rn语句未结束rn/bbs/新建 文本文档.asp, line 54, column 19rntitle=" 第"&RS.AbsolutePage&"&/&"&RS.PageCount&"页rn------------------^rn原码:rntitle=" 第"&RS.AbsolutePage&"/"&RS.PageCount&"页 共"&RS.RecordCount&"条记录rnIF RS.AbsolutePage>1 thenrntitle=title&"上一页"rnElsern title=title&"上一页"rn End ifrn if RS.AbsolutePage下一页"rn Elsern title=title&"下一页"rn if RS.AbsolutePage>1 thenrn title=title&"首页"rn elsern rn title=title&"首页"rn End ifrn IF RS.Absolutepage尾页"rn else rn rn title=title&"尾页"rn end ifrntitle=title&"第页"
哪出错了???
以下代码哪出错了???怎样改??rnimport java.awt.*;rnimport java.awt.event.*;rnimport javax.swing.*;rnimport java.sql.*;rnimport java.util.*;rnpublic class DatabaseFrame extends aFramern public static void main (String [] args)rn aFrame frame = new aFrame();rn frame.setDefaultCloseOperation(EXIT_ON_CLOSE);rn frame.setSize(300, 400);rn frame.show();rn rn rnrnclass aFrame extends JFramern public aFrame()rn Container c = getContentPane();rn c.add(new aPanel());rn rnrnrnclass aPanel extends JPanelrn private JTextField text1 = new JTextField(15);rn private JTextField text2 = new JTextField(15);rn private JTextField text3 = new JTextField(15);rn private JTextField text4 = new JTextField(15);rn private JTextField text5 = new JTextField(15);rn rn private JButton abutton = new JButton("Add");rn private JButton bbutton = new JButton("Cleat");rn rn private JPanel a = new JPanel();rn private JPanel b = new JPanel();rn rn public aPanel()rn add(a, BorderLayout.CENTER);rn add(b, BorderLayout.SOUTH);rn rn a.setLayout(new GridLayout(5,1));rn a.add(text1);a.add(text2);a.add(text3);a.add(text4);a.add(text5);rn b.add(abutton);b.add(bbutton);rn abutton.addActionListener(add);rn bbutton.addActionListener(clear);rn rn rn addlistener add = new addlistener();rn clearlistener clear = new clearlistener();rn rn rn private class addlistener implements ActionListenerrn Connection con = null;rn public void database() throws SQLException, ClassNotFoundExceptionrn Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");rn con = DriverManager.getConnection("jdbc:odbc:personinfo");rn Statement stmt = con.createStatement();rn tryrn int rs = stmt.executeUpdate("insert into personinformation (name, "rn + "sex, birthday, address, telephone) values ('" + text1.getText()rn + "', '" + text2.getText() + "', '" + text3.getText() + "', '" +rn text4.getText() + "', '" + text5.getText() + "')");rn System.out.print(rs);rn rn catch(SQLException s)rn System.out.print("sql");rn rn finallyrn stmt.close();rn con.close();rn rn rn public void actionPerformed(ActionEvent e)rn add.database();rn rn rn rn private class clearlistener implements ActionListenerrn public void actionPerformed(ActionEvent e)rn text1.setText("");rn text2.setText("");rn text3.setText("");rn text4.setText("");rn text5.setText("");rn rn rn
到底是哪出错了
在执行时会抱这个错误rnProject Project1exe raised exception class EClassNotFound with message 'Class TDBText not found' Process stopped.Use Step or Run to continue rn各位大哥指点,最好留下QQrnrn
初学者 不知道哪错了
rnrn factor!!!!rn rnrnrnrn rnrnrn rnrn--------------------------------------------------------------rnrn看了几遍,不知道哪错了,求教。谢谢。
看下哪出错了。。
#includernusing namespace std;rnclass QNErnrn public :rn static int a;//定义静态成员 rn int b;rn ONE(int c,int b)rn a=c;this->b=b; rn ;rn int ONE::a=0;//类外定性说明 rn int main()rn rn ONE one(10,20);rn cout<<"one.a="<
python不知道哪错了
不知道哪里出错了 运行不了 就是创建一个文本文件,将文本写入文本文件rnrnrnrn'''makeTextFile.py--creat text file,rn now'''rnrnimport osrnls=os.lineseprnrn#get a filenamernwhile True :rn fname=raw_input()rn if os.path.exists(fname):rn print "Error: '%s' already exists", fnamern else :rn breakrnrnrn#get file content(test) linesrnall=[]rnprint "\nEnter lines('.' by itself to quit).\n"rnrn#loop until user terminates inputrnwhile True:rn entry=raw_input('.')rn if entry=='.':rn breakrn else:rn all.append(entry)rnrnrn#write lines to file with proper line-endingrnrnfobj=open(fname,'w')rnfobj.writelines(['%s%s' % (x,ls) for x in all])rnrnfobj.close()rnprint 'Done!'rn
不知道哪错了????
题目:rnrnA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exists a strictly increasing sequence of indices of X such that for all j = 1,2,...,k, xij = zj. For example, Z = is a subsequence of X = with index sequence <1, 2, 4, 6>. Given two sequences X and Y the problem is to find the length of the maximum-length common subsequence of X and Y.rnrnThe program input is from a text file. Each data set in the file contains two strings representing the given sequences. The sequences are separated by any number of white spaces. The input data are correct. For each set of data the program prints on the standard output the length of the maximum-length common subsequence from the beginning of a separate line.rnrnSample Inputrnrnabcfbc abfcabrnprogramming contest rnabcd mnprnrnSample Outputrnrn4rn2rn0rnrnrnrnrnrnrnrnrnrn一下是我的答案,对这些数据没有错误,但是提交就是wa....rnrnrnrn#includern#includernusing namespace std;rnint main()rnrn string a,b;rn int i,j,alen,blen,cnt,p;rn while(cin>>a>>b)rn rn cnt=0;rn p=0;rn rn alen=a.size();rn blen=b.size();rn for(i=0;i
哪出错了
设计一个函数,用来判断一个整数是否为素数rn#include rnint abc(int a)rnrnint i;rnif(a<=1)rnreturn 0;rnelsernrnfor(i=2;i
哪一行出错了?
what is the output of this code?rntypedef structrn int age;rn char name[20];rnPerson;rnrnPerson p=25,"John";rnPerson *ptr=&p;rnprintf("%d",ptr->a);rnrnrnA 25rnB JohnrnC ErrorrnD Address of prnrn正确答案是CrnrnPerson *ptr=&p; 看不懂,一个指针?rnprintf("%d",ptr->a);看不懂,a是一个对象?rnrn这哪一行出错了?
哪一句出错了?
class Demo1rnrn public int a; rnrnrnclass Demo2rnrn public jisuan(Demo1 d) //参数为Demo1的对象drnrn int x=d.i; //(1)rn int y=i; //(2)rnrnrnrn在(1)(2) 两个语句中那个是错误的啊??
看看哪出错了
写一个C或者C++程序完成字符串的转换,如把2008转换为1个2,2个0,1个8,即122018;my2009转换为1m1y122019rnrnrnrnrnrn#include "stdio.h"rn#include"string.h"rnchar * fun(char *p)rnrn char *s,t;rn int i=0,j=0;rnrn for(i=1;*p!='\0';p++,j++)rn rn t=*p;rn for(i=0;*p==t;p++)rn rn i++;rn rn *(s+(j++))=i;rn *(s+j)=*(--p);rn rn *(s+j)='\0';rn return s;rnrnrnvoid main()rnrn char *a;rn scanf("%s",a);rn printf("%s",fun(a));rnrnrn
编译错误,哪出错了?
--------------------Configuration: ogltest - Win32 Debug--------------------rnLinking...rnLIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16rnDebug/ogltest.exe : fatal error LNK1120: 1 unresolved externalsrnError executing link.exe.rnrnogltest.exe - 2 error(s), 0 warning(s)rn
hd1004哪出错了
Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and find the result.rnrnThis year, they decide to leave this lovely job to you. rnrn rnrnInputrnInput contains multiple test cases. Each test case starts with a number N (0 < N <= 1000) -- the total number of balloons distributed. The next N lines contain one color each. The color of a balloon is a string of up to 15 lower-case letters.rnrnA test case with N = 0 terminates the input and this test case is not to be processed.rnrn rnrnOutputrnFor each case, print the color of balloon for the most popular problem on a single line. It is guaranteed that there is a unique solution for each test case.rnrn rnrnSample Inputrn5rngreenrnredrnbluernredrnredrn3rnpinkrnorangernpinkrn0rn rnrnSample Outputrnredrnpinkrnrnrnrn代码如下:rn#includern#includern#includernusing namespace std;rnrnint main()rnrn //freopen("input.txt","r",stdin);rn int N;rn while(cin>>N&&N)rn rn string str[10010];rn int arr[1000];rn memset(arr,0,sizeof(arr));rn int i,j;rn for(i=0;i>str[i];rn if(i==0)rn arr[i]=1;rn elsern rn for(j=0;jarr[j])rn rn k=i;rn rn cout<rn#includern#includernusing namespace std;rnrnint main()rnrn //freopen("input.txt","r",stdin);rn int N;rn while(cin>>N&&N)rn rn string str[10010];rn int arr[1000];rn memset(arr,0,sizeof(arr));rn int i,j;rn for(i=0;i>str[i];rn for(j=0;j<=i;++j)rn rn if(str[i].compare(str[j])==0)rn rn arr[j]++;rn rn rn rn int k;rn for(i=1;iarr[i]?k=j:k=i;rn cout<
排序不知道哪错了
[code=c]#include rnrnint main(void)rnrn long array[5]=5,4,3,2,1;rn int i,j,key;rnrn for(i=1;i<5;i++)rn rn key=array[i];rn j=i-1;rn while(j>=0 && array[j]>key)rn rn array[j+1]=array[j];rn j--;rn rn array[j]=key;rn rn rn for(i=0;i<5;i++)rn printf("%d",array[i]);rn[/code]
新手,不知道哪错了....
#include < stdio.h >rnvoid main()rnrn int i,num[10];rnrn for ( i=0;i<=9;i++; )rn scanf( "%d",&num[i] );rnrn for ( i=0;i<=9;i++; )rn printf( "%d",num[i] );rnrn上面在VC里有一个错误....不知道在哪....求大家帮我看看.........
取值,不知道哪错了。。。
function addTest()rn var n = s.length;rn var s1 = "s"+(n+1);rn var s2 = "s"+(n+2);rn s[n] = s1;rn s[n+1] = s2;rn document.getElementById("add").innerHTML+="[color=#FF0000]商品品牌:商品类别:[/color][color=#0000FF]商品货号: 数量: 单价:"[/color]; rn for(var i=n;i 数量: 单价:";rnrnrnrnrn添加商品 rnrnrnrnrnrnrnrnrnrnrnrnrnrnrn为什么在另一个页面上获取不到本页的值?(红色标注的地方的值)rn但是蓝色标注的地方却能获取到值,我实在找不出问题来,请大家帮忙。谢谢~~~~~rn答完马上给分
不知道哪错了
void main()rnrnint max(int x,int y);//这个后面加了分号不违法。。rnint a,b,c;rnscanf("%d,%d",&a,&b);rnc=max(a,b);rnprintf("max=%d\n",c);rnrnint max(int x,int y) //这个后面加了分号就违法了。。rnrnint z;rnif(x>y) z=x;rnelse z=y;rnreturn(z);rnrnrn反复和例子比较几次,都一样啊,为什么出现错误:undefined symbol_print in module noname01.crnrn还有就是max是函数吧?定义函数后面不能加分号是吧?为什么例子第一个定义的函数后面加了分号的?还不违法
不知道哪错了.
#include "stdio.h"rn#include "conio.h"rnstruct sturnrn int a;rn int b;rn struct stu *next;rna[2];rnmain()rnrn int i;rn struct stu *p,*head;rn head=p;rn for(i=0;i<2;i++)rn rn p=&a[i];rn scanf("%d %d",a[i].a,a[i].b);rn p=p->next;rnrn rnrn printf("a=%d,b=%d",p->a,p->b);rnrn getch();rnrnrnrn我输入:rn1rn1rn1rn1rn为什么输出a=1,b=0?
不知道到底是哪错了?
以下是小弟照书(PDF不是很清楚)编的一个猜数字的小游戏,对于文本属性的一些问题还是不大明白,比如像textattr的用法,请大家帮忙看看哪有错误!rnrn#include rn#include rn#include rn#include rnvoid main(void)rnrn int answer[4],guess=0,a,b,times=0,i,j; /*定义数组answer[4]用来放答案,guess用来放玩家所猜出的数,位置和数字都对的用A来表示,只是数字对的用B表示*/rn clrscr();rn for (i=0;i<=3;i++)rn rn randomize(); /*随机数发生器*/rn answer[i]=rand()%10; /*这句就有些不明白了,请达人详解*/rn for (j=0;j9999);rn for (i=3;i>-1;i--)rn rn for (j=0;j<4;j++)rn rn if ((int)(guess/pow10(i)==answer[j]) /*开始比较最高位的数是否和答案一样*/rn rn if (i+j=3) a=a+1;rn else b=b+1;rn rn rn guess=guess-(int)(guess/pow10(i))*pow10(i); /*去掉上次比较的那一位数,进入下一位比较*/rn rn window (20,0,40,31);rn cprintf ("\n\r% %dA%dB\n",a,b); /*最后输出是_A_B*/rn rn
疯了 不知道哪错了
Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auctionManager' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Cannot resolve reference to bean 'auctionUserDao' while setting bean property 'userDao'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'auctionUserDao' is definedrnCaused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'auctionUserDao' is definedrnrn----------------------------------rn相关代码rnorg.qjkt.service.impl.AuctionManagerImplrnrnrnprivate AuctionUserDao userDao;rn private BidDao bidDao;rn private ItemDao itemDao;rn private KindDao kindDao;rn private StateDao stateDao;rn private MailSender mailSender;rn private SimpleMailMessage message;rn rn public void setUserDao(AuctionUserDao userDao) rn this.userDao = userDao; rn rnrn public void setBidDao(BidDao bidDao) rn this.bidDao = bidDao; rn rnrn public void setItemDao(ItemDao itemDao) rn this.itemDao = itemDao; rn rn--------------------------------------------------------------rnapplicationContext.xmlrnrn rn rn rn rn rn rn rn rn rn------------------------------------------------rn希望大家踊跃发言 谢谢大家了
不知道哪里出错了…
各位大哥好, 工作上临时需要用php操作个数据库, 但是不知道为什么一直无法成功Insert数据进Database, 想请各位帮忙检查一下哪里出错了rnrnrn rnrn". $row1[0] . " ";rn rn rn rnrnelsernrn echo "different--->". $row[0]. " ";rn rn rn mysql_select_db("testPLM",$connect);rn rn mysql_query("SET NAMES utf8");rn //底下要把另一个数据库没有的数据加入, 可是都报错rn mysql_query("INSERT INTO version (name, time, description) VALUES('$row[0]', NULL, NULL)") or die('Insert data fail');rn rnrnrn rnrnrn rn?>
不知道哪出錯了!
private void btn_InsertOrUpdate_Click(object sender, System.EventArgs e)rn rnrn cn = bb.GetOldDBConnction();rn OleDbDataAdapter adapter = new OleDbDataAdapter("select * from jobtable",cn);rn OleDbCommandBuilder builder = new OleDbCommandBuilder(adapter);rn DataSet data = new DataSet();rn adapter.Fill(data,"jobtable");rn rn //OleDbDataAdapter Adapter = (System.Data.OleDb.OleDbDataAdapter)table.ExtendedProperties["test"];rn rn foreach(DataRow row in data.Tables["jobtable"].Rows)rn rn if(row["id"].ToString().Equals("1"))rn row["Inetval"] = 11;rn rn DataRow Row = data.Tables[0].NewRow();rnrn Row["RunTime"] = DateTime.Now;rn Row["RunNextTime"] = DateTime.Now.AddMinutes(11);rn Row["Inetval"] = 11;rn rn data.Tables[0].Rows.Add(Row);rn rn cn.Open();rnrn //OleDbDataAdapter Adapter = new OleDbDataAdapter();rn tryrn rn int i = adapter.Update(data,data.Tables[0].TableName);rn rn rn catch(Exception ex)rn rn throw new Exception(ex.Message);rn rn finallyrn rn cn.Close();rn rn rn rn這是我今天無聊寫的一個小測試用例,結果老是報一個錯誤:rnrnex.Message: "对于不返回任何键列信息的 SelectCommand 不支持 UpdateCommand 的动态 SQL 生成。"rnrn請達人幫個忙,解釋一下!謝謝!
不知道哪里出错了
[code=C#]rnrn protected void Button1_Click(object sender, EventArgs e)rn rn // int a = Convert.ToInt32(this.RadioButtonList1.SelectedValue);rn SqlConnection con = DB.createConnection();rn con.Open();rn SqlCommand cmd = new SqlCommand();rn cmd.Connection = con;rn cmd.CommandText = "update Title set titleID=Convert.ToInt32(this.RadioButtonList1.SelectedValue)";rn cmd.ExecuteNonQuery(); rn con.Close(); rn rnrnrn[/code]rn提示我“。”附近有错误。不知道是update写错了还是怎么了。rn之前我弄了个RadioButtonList,我想获得被选中项的this.RadioButtonList1.DataValueField的值,不知道this.RadioButtonList1.SelectedValue是不是这个值。rnrn我想用这个值更新一下下面的表[code=SQL]rncreate table Titlern(rn id int primary key, --编号rn titleID int default 1 not null --投票的标题序号rn)rnrninsert into Title values(1,1)rn[/code]rn之前还有一段我绑定控件的代码:rn[code=C#]rn protected void Page_Load(object sender, EventArgs e)rn rn SqlConnection con = DB.createConnection();rn con.Open();rn SqlCommand cmd = new SqlCommand("select * from voteMaster",con);rn SqlDataReader sdr = cmd.ExecuteReader();rn this.RadioButtonList1.DataTextField = "voteTitle";rn this.RadioButtonList1.DataValueField = "voteID";rn this.RadioButtonList1.DataSource = sdr;rn this.RadioButtonList1.DataBind();rn sdr.Close();rn con.Close();rn [/code]rnrn我就是想实现用voteMaster表中的voteID的值去更新Title表中的titleID。好心人帮帮忙吧,先谢了。
不知道哪里出错了:(
我想复制一个标记块,但就是出不来~rnrnrn rnrnrn rnrnrnrn其中book.xml为:rnrnrn rn 我rn Carl Saganrn Ballantine Booksrn rn rn Catwingsrn Ursula K. Le Guinrn Scholasticrn rn rn Home Townrn Tracy Kidderrn Random Housern rnrnrn就是跳不出什么东西来啊~
出错了,不知道为什么?
connDB.asprn<% rnset conn=Server.CreateObject("ADODB.Connection") rnDBPath = Server.MapPath("grzh.mdb") rnconn.Open "provider=microsoft.jet.oledb.4.0;data source="&dbpath rn%> rnrn<%@language=vbscript%>rn rn<%rn 'xming0=request.form("xming0") rn 'sfzhao=request.form("sfzhao")rn 'sql = "select * from grzh where sfzhao = '"&sfzhao&"' and xming0= '"&xming0&"'"rn set rs=server.CreateObject("adodb.recordset")rn sql = "select * from grzh"rn rs.open sql,conn,1,3rn if not rs.eof thenrn%>rn错误rn错误类型:rnADODB.Recordset (0x800A0BB9)rn参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。rn/grzh/grzh.asp, 第 9 行rnrnrn浏览器类型:rnMozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) rnrn网页:rnGET /grzh/grzh.asp
关于数组,哪错了?
<% rndim rs3 rndim sql rndim count1rndim rs1 rndim sql1 rndim rs2 rndim sql2 rndim count2rndim trnset rs3=server.createobject("adodb.recordset")rnrnsql = "select * from diduan order by id" rnrs3.open sql,conn,1,1rn%> rn
定义数组出错了。。。。。
dim arr_one()rn在这一句上老是出现rn 类型不匹配:'arr_one' 的错误提示rn请问这是为什么?
数组,哪儿出错了
#includern#includernusing namespace std;rnint const N=100;rnvoid calculate(int a[N][N],int b[N][N],int c[N][N],int,int,int);rnint main()rn int a[N][N],b[N][N],c[N][N]=0;rn int m,n,p;rn cin>>m>>n;rnfor(int i=0;i>a[i][j];rncin>>n>>p;rnfor(i=0;i>a[i][j];rncalculate(a,b,c,m,n,p);rnfor(i=0;i
相关热词 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法 c# gmail 发邮件 c# 多层文件