الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

كودjdbc

بدأه لؤلؤه مضيئه في 17 يناير 2009 · 2 رد · 584 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

في الكود اخطاء ماادري كيف اصححها بليز ساعدوني هذا مشروع ومطلوب اسلمه هذا الاسبوع وانا متوهقه

String text;
	 String [] text1,text2;
		System.out.println("plz enter your statement");
Scanner input=new Scanner(System.in);
text=input.nextLine();

	text1=text.split(" ");

int  w=text1.length;

try{


				Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");


	Connection c = DriverManager.getConnection("jdbc:odbc:oracle", "system", "123456");
	   Statement s = c.createStatement();
	for(int n=0;n<w;++n)
	{
	   ResultSet results = s.executeQuery(
  "select path from word where name==text1[n] ");

	String location =results.getString();//هنا الخطأ 
	ImageIcon icon = new ImageIcon(location);
JLabel lPhoto = new JLabel(icon);
setLayout(new GridLayout(1, 1));//وايضا هنا الخطأ
add(lPhoto);
	if(location==null)//if the word is not found in [url="""]DataBase[/url]


	{

		//String t= text1.getText();
		 int j=text1[n].length();   
String result="";
			int i =0;
			for(i=0;  i<j;i++)
			{
			   result += text1[n].substring(i,i+1)+" \n ";


			}
			jLabel2.setText(result);}}

}
	catch( Exception a ) {
  }
#2

وعليكــم السـلام ورحمة الله وبركاتـه..

results.getString();

خطأ لأنك يجب أن تحدد العمود الذي تريد أن تأخذ منه القيمه (سواء باسمه ، أو برقمه) . مثلا :

results.getString(1);

أو

results.getString(name);

اذا كان يوجد عمود بالأسم name .

أيضا يبدوا أن سطر الSelect غير صحيح أيضا ، فتأكد منه :

"select path from word where name == " + text1[n]

بالتوفيق ،،

تم تعديل هذه المشاركة بواسطة Wajdy Essam في 17 يناير 2009 في 22:52

http://informatic-ar.com منصة تعليمية عربية في علوم الحاسب والبرمجة

https://moalfat.com  للكتب الالكترونية والكورسات التعليمية

Everything we see now is just an engineering solution based on old science

#3

شكرا لك اخي لكن يبقى خطأ عندي وهو

ImageIcon icon = new ImageIcon(location);
JLabel lPhoto = new JLabel(icon);
setLayout(new GridLayout(1, 1));هنا الخطأ
add(lPhoto);

تم تعديل هذه المشاركة بواسطة لؤلؤه مضيئه في 17 يناير 2009 في 23:23