Select query not getting data
i am using a query in my asp.net application "select * from tablename" it is not working. the table is in relationship with two other table i removed relation but still not working. the same query is working for the other table
i am using a query in my asp.net application "select * from tablename" it is not working. the table is in relationship with two other table i removed relation but still not working. the same query is working for the other table
Hello,
It is not clear why this thread moved to VB.NET forum, but it seems that your issue is mainly related to web development, you could consider posting this issue in
https://forums.asp.net forum to get support.
Regards,
Carl
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Similar Messages
-
Join query not getting data from tables
I have total 4 tables, zemployee, zemp_comm,zemp_adress, zemp_edu1 all of this tables are connected through emp_id , but when I write left outer join it returns all rows but emp_id is retrunign null , when I insert all of the entries in respective table it show the respective emp_id, when i left some of the entries in table it will not show emp_id in records,
I am using this select statment........
Select * from zemployee as a left outer join zemp_comm as b on b~emp_id = a~emp_id left outer join zemp_adress
as c on c~emp_id = a~emp_id left outer join zemp_education1 as d on d~emp_id = a~emp_id into corresponding fields of table
emp_itb
where a~emp_name = zemployee-emp_name.
I want to show show records with emp_id whether i put entry in all tables or missed some of the entries.
please help me in this regard.Hi Amir,
You can use Inner join . please refer below code.
Select * from zemployee as a inner join zemp_comm as b on b~emp_id = a~emp_id inner join zemp_adress
as c on c~emp_id = a~emp_id inner join zemp_education1 as d on d~emp_id = a~emp_id into corresponding fields of table
emp_itb
where a~emp_name = zemployee-emp_name.
Regards,
Thangam.P -
Can not get data from database
hi all,
there is a problem , when i write like below :
SELECT * FROM bsis INTO CORRESPONDING FIELDS OF TABLE it_temp
WHERE bukrs = p_bukrs
AND hkont = p_hkont.
p_bukrs , p_hkont are all on the selection screen , and p_bukrs = 1200 another is eq blank. i can not find any data , but with the same condition i can find some data in database , when i debeg i found that p_hkont is initial.
when i write like this :
SELECT * FROM bsis INTO CORRESPONDING FIELDS OF TABLE it_temp
WHERE bukrs = p_bukrs .
this time i can find the data like the database.
so , does someone know where the problem is , why i can not get data ?
kind regards
kevinhi,
if u r using bukrs and hkont as parameters in selection screen then
SELECT * FROM bsis INTO CORRESPONDING FIELDS OF TABLE it_temp
WHERE bukrs = p_bukrs
AND hkont = p_hkont.
this will work.
if u r using then as select-option then the above does n't work.
bcoz select-options work as internal table bcoz of that u have use the query like this
SELECT * FROM bsis INTO CORRESPONDING FIELDS OF TABLE it_temp
WHERE bukrs IN p_bukrs
AND hkont IN p_hkont.
<REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>
Edited by: Alvaro Tejada Galindo on Aug 15, 2008 5:25 PM -
Select Query Based on date condition
Hi ,
Is it Possible.
i want to run select query based on date condition.
Eg...
if the date between 01-jan-01 and 01-jan-05 then
select * from table1;
if the date between 02-jan-05 and 01-jan-08 then
select * from table2;
Becaz i have data in 2 diffrent tables , based on the date condition i wnt to run the select statement to diffrent tables.
i dont want plsql here Just SQL needed.
thanks,
-R
Edited by: infant_raj on May 5, 2009 11:48 PMHelo Kanish,
this is not the one i was asking..
wht i mean was .
i use bind variable to get date while running the select statement , once i get the date then i want to choose any one of the table to run select query.
EG..
select col1,col2 from table1 where date between only if 01-jan-01 and 01-jan-05;
select col1,col2 from table2 where date between only if 02-jan-05 and 01-jan-08;
Run any one of the two . not all
thanks,
_raj -
Hi all,
i am craeating a dimension and i did the mapping also.i get the data in that dimension table.But i am not able to get the data in the Dimesion (i.e When i right click on the dimesion which i have created,there one option is called Data Viewer,from that i am not getting data)
Can any help me about this.Hi,
Just try with the code given below... hope that helps you out....
also write a break-point statement just before the if statement and check in the debugging mode if it i_mseg table has some values or not...
if i_mseg[] is not initial.
select zzlcno zzlcdt
into i_ekpo from ekpo
for all entries in i_mseg
where ebeln = i_mseg-ebeln.
append i_ekpo.
endselect.
endif.
OR
if i_mseg[] is not initial.
select zzlcno zzlcdt
into corresponding fields of i_ekpo from ekpo
for all entries in i_mseg
where ebeln = i_mseg-ebeln.
append i_ekpo.
endselect.
endif.
Regards,
Siddarth -
Not getting data for Null Records.
Hi all,
I am trying to fetch the records where sczuo values are NULL .
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE makz.
DATA : END OF itab.
SELECT * FROM makz INTO TABLE itab WHERE sczuo IS NULL.
IF sy-subrc EQ 0.
LOOP AT itab.
WRITE : /3 itab-matnr , 20 itab-sczuo.
ENDLOOP.
ENDIF.
I did not getting data any data .But if i write select statement like this
SELECT * FROM makz INTO TABLE itab WHERE sczuo = ' '.
This select statement returns the correct data.
why my first select statement is not working ? how can i use IS NULL?
Thanks in Advance,
MadhuHi,
When we insert a new field to an existing table, NULL values are automatically inserted into the new field by the system for all existing records. However NULL and SPACE are not the same.
The logical expression SQL condition is either "true, false, or unknown". The expression is UNKNOWN if one of the columns involved in the database contains a NULL value and such records could be retrieved by using u201CIS NULLu201D instead of SPACE.
Please note that the NULL value is inserted only for the existing records, by the time the new field is being inserted. For all new records, SPACE or the initial (default) value is inserted.
If the new field is inserted by checking the checkbox u201Cinitial valuesu201D, then the initial values (SPACE in case of characters) are automatically inserted and not the NULL values.
ihope u get the solution...
Thanks
Ashu -
Select Query Between two dates...
Hi Guru's,
I need a Select Query between two dates, also if the record not found for any in between date then it should return NULL or 0 ...
for Example
1. I am having two records in DB for date 2-10-2008 & 4-10-2008
2. Now suppose I have given Query for date between 1-10-2008 to 5-10-2008
Then it should return me 5 records with valid values for 2 & 4 and NULL for other 1,3,5
Thanks.Try like this:
with
t as
select date '2008-10-02' as dt, 'Record #1 (in DB)' as str from dual union all
select date '2008-10-04' as dt, 'Record #2 (in DB)' as str from dual
select v.dt, t.str
from (
select date '2008-10-01' + level - 1 as dt
from dual
connect by level <= (date '2008-10-05' - date '2008-10-01') + 1
) v
left join t
on v.dt = t.dt
order by 1 -
Not getting data into 3rd int table
Hi all,
here i ve data in 2 internal tables. this data i want store into 3rd internal table, here am adding with inner join but am not getting data into 3rd one.
plz check my logic.
REPORT ZEXCHANGE_RETES .
TABLES : tcurr, " Exchange Rates
/msg/rabr. " Account (Posting Headers)
DATA : l_date type datum.
TYPES : begin of t_tcurr,
kurst like tcurr-kurst, " Exchange Rate type
fcurr like tcurr-fcurr, " From Currrency
gdatu like tcurr-gdatu, " Date as of which
end of t_tcurr.
TYPES : begin of t_rabr,
OW_WHGNR like /msg/rabr-OW_WHGNR,
bil_dat like /msg/rabr-bil_dat,
abrnr like /msg/rabr-abrnr,
end of t_rabr.
TYPES : begin of t_output,
kurst like tcurr-kurst,
fcurr like tcurr-fcurr,
gdatu like tcurr-gdatu,
OW_WHGNR like /msg/rabr-OW_WHGNR,
bil_dat like /msg/rabr-bil_dat,
abrnr like /msg/rabr-abrnr,
end of t_output.
DATA : it_output TYPE STANDARD TABLE OF t_output WITH HEADER LINE,
wa_output TYPE t_output.
DATA : it_rabr TYPE STANDARD TABLE OF t_rabr WITH HEADER LINE,
wa_rabr TYPE t_rabr.
DATA : it_tcurr TYPE STANDARD TABLE OF t_tcurr WITH HEADER LINE,
wa_tcurr TYPE t_tcurr.
getting data into 1st itab
SELECT kurst fcurr gdatu
from tcurr into table it_tcurr
where kurst EQ 'M'.
SORT it_tcurr by fcurr GDATU DESCENDING.
delete adjacent duplicates from it_tcurr comparing fcurr.
getting data into 2nd itab
SELECT * FROM /msg/rabr into CORRESPONDING FIELDS OF TABLE it_rabr.
SORT it_rabr BY OW_WHGNR bil_dat abrnr.
getting data into 3rd itab
SELECT t~kurst
t~fcurr
t~gdatu
r~OW_WHGNR
r~bil_dat
r~abrnr
FROM tcurr as t INNER JOIN
/msg/rabr as r on tfcurr EQ rOW_WHGNR into table it_output
WHERE rabrnr BETWEEN '00000000000000800251' AND '00000000000000800300' AND rbil_dat < wa_tcurr-gdatu.
printing output
LOOP at it_output into wa_output.
WRITE: /10 wa_output-kurst,
15 wa_output-fcurr,
25 wa_output-gdatu,
50 wa_output-OW_WHGNR,
60 wa_output-bil_dat,
80 wa_output-abrnr.
ENDLOOP.
here am not getting data into 3rd i tab.
Thanks & Regards,
sudharsan.Hi,
The select command is the most fundamental function of writing ABAP programs allowing the retrieval of data from SAP database tables.
Try filling the 3rd internal table with Loop ... Endloop.
Loop at t_tcurr.
Read table t_rabr with key field1 = t_tcurr-field1.
If sy-subrc = 0.
Move t_tcurr-field1 = itab_final-field1.
Move t_tcurr-field2 = itab_final-field2.
Move t_rabr -field3 = itab_final-field3.
Move t_rabr -field4 = itab_final-field4.
Append itab_final.
Endloop.
Hope this helps you.
Regards,
Ruthra -
Not getting data for 1 field in ODS
Hi BW Experts,
I am loading the data from R/3 to BW.I have loaded the data through PSA.The data is available in New data field. After activating the ODS, for 1 field the data is not uploaded and in the report, the values are not displaying.
I have checked the Transformations also. it is mapped correctly.But still i am not getting data for that field.
Thanks,
Siva.Thanks for the Update
1. What is your Service Pack Level?
Service Pack is 0016
2. Are you able to see the data in PSA?
Yes I can see the data in PSA
3. After load, are you able to see the value in New table?
Yes i can able to see the data in New data table
4. Anywhere, are you doing the SORTING of Data Package?
No I have not sorted the data Package.I have not written any coding on this
I have not written any coding in transformation also.
Thanks,
Siva. -
hi,
in my scenario, XI is passing the data back to RFC, but in my program where i call the RFC, the data is not received. what could be the issue.
CALL FUNCTION 'ZFFF' DESTINATION 'XI'
TABLES
INP = aaa
OUT1 = bbb
OUT2 = ccc.
COMMIT WORK.
it was working fine before when i had only OUT1. Later I added OUT2 and then onwards I am not getting data for any of the tables. I have checked in XI, data is being passed out of XI to RFC. No issues in that.
something seems to have gone wrong in the RFC modfication or the RFC call. can anyone please help.
thksHi,
Check the export import parameter declarations & data types in both RFC & XI.
Put a break point in RFC & check whether it is getting triggered.
Best regards,
Prashant -
Hi Experts,
i am facing the below critical issue.
i have enhanced 2 fields, item start date and end date to crm data source 0CRM_SRV_PROCESS _I Data Source.
while checking data from RSA3 i have got data for those 2 fields(item start date and end date) in CRM System, but while running Infopackage i am not getting data of those 2 fields to BI PSA table.
i got data from RSA3 in CRM Quality and Production Systems and not getting data in Quality and Production BI Systems at PSA level.
But i am getting data in RSA3 in CRM development system and BI Development system at PSA level.
Means i am facing issue only at Quality and Production BI Systems at PSA level.
Please find below screen shots for reference:
RSA3 Screen shot from CRM Quality System:
PSA Screen shot from BI Quality System:
Thanks & Regards,
Nagaraju KHi Anshu,
i have enhanced almost 20 fields for same data source, among these 20 fields other date fields also there which all are getting fine in dev, qty and production systems.
but only these 2 fields are not getting data to BI PSA level in Quality and productions systems.
Please find below code for reference:
if lt_service_assign is NOT INITIAL.
READ TABLE lt_service_assign into ls_service_assign with key ITEM_GUID = ls_data-item_guid.
if sy-subrc = 0.
CALL FUNCTION 'CONVERT_TIMESTAMP_TO_BP_TIME'
EXPORTING
BP_GUID_32 = ls_data-item_guid
IM_TIMESTAMP = ls_service_assign-BEG_TSTMP
IMPORTING
EX_DATE = lv_start_date.
* EX_TIME =
if sy-subrc = 0.
ls_data-ZZITM_STARTDT = lv_start_date.
endif.
CALL FUNCTION 'CONVERT_TIMESTAMP_TO_BP_TIME'
EXPORTING
BP_GUID_32 = ls_data-item_guid
IM_TIMESTAMP = ls_service_assign-END_TSTMP
IMPORTING
EX_DATE = lv_end_date.
* EX_TIME =
if sy-subrc = 0.
ls_data-ZZITM_ENDDT = lv_end_date.
endif.
endif.
endif. -
On a west Texas highway I believe my old 3G iphone could get data with 3 bars. My new 4S could make phone calls but not get data. An att guy told me it's because there aren't enough 4G towers yet. Other explanations?
Simple solution. Get a real internet service and not a cell phone internet connection service it was never meant to be used as the primary internet service
And how do you lose a home and job and be sued as you claim. What over 10 Gb of data? Give me a break
In my city small claims is $5000.00
And over that amount you can go to a superior court to have your issue settled.
http://www.bbb.org
Good Luck, Elector -
IR Dashboard report from new query not getting all Quick Filter selections
I inherited an IR Dashboard .bqy and my user recently added a new Query, Result, Table, and Report section to it. I cannot get the report to dynamically filter based on the date chosen in the existing Quick Filters section. It seems to be filtering the Location properly (drop down in Quick Filters section), but not the date. Her result section refuses to show anything less than ALL dates from the query.
The other reports/pivots already on the dashboard work fine with all QuickFilters.
In my attempt to integrate her new report in to the dashboard I add a new hidden "dummy" pivot (based on the existing query btw, not the new query-could that be the issue? it's dummy though so i figured it was ok), reference this pivot in the Embedded Targets object I found by adding "Object~Pivot4|Type~9|Target~Casket Margin Summary" line,
went to Dashboard Studio and was able to Associate this report in to the right frame, etc.
In the script behind the QIQ date "Set Filters" button I saw this code for the existing "Result_Detail" section so I added a line for my new "Results_Merch Detail" section.
var objServDate = ActiveDocument.Sections["Casket Margin"].Shapes["Service_Date^qiqlbx^showname^a"];
if (objServDate.SelectedList.Count > 2){
Alert("Please select only two dates");
return;
ActiveDocument.Sections.Item(txlMe.Text).Qiq_onControlClick(this.Parent,this)
ActiveDocument.Sections["Results_Merch Detail"].Limits["Service Date"].Operator = 11
ActiveDocument.Sections["Results_Detail"].Limits["Service Date"].Operator = 11;
I tried it with and without an extra semi-colon at the end of my line. Is that the right way to tell it to apply it to more than 1 Result??
Worked with this for hours now and can't find whatever else is hidden which tells the QIQfIlter Date to refresh this NEW query/result when chosen.
I tried to make sure all Filter items exist in the new query's Request line, one was missing. i haven't gone back to Dash Studio since then and re-saved, does THAT matter? I saved the .BQY and re-processed, still no luck.
can anyone help? I'm desperate for suggestions.
Thank you!
KarenThis has been resolved. The main thing that kept it from working was I kept launching the Dashboard Studio after I was in Design mode so any time I got to the QIQ Filters setup screen it looked like cryptic code and there was nothing to alter or play with to try and force the filters to take effect, so I never changed anything.
This time I launched the Dashboard Studio while accidentally in regular mode, blessing in disguise. on Step 1 of the wizard I chose QIQ Filter Properties from the configuration drop down list which pops up the Local Filters setup window, now in place of code syntax there was english-like words & action items for me to play around with so I chose my new result set from the drop down list and highlighted all the limits and clicked "Set Filters". Presto, that did it.
Also I had to make sure all the columns referenced in the QIQ drop down lists and pick list was in my request line in the Query & Result section, repeat the above, and it's all working great now.
Thanks,
Karen -
I prepared a GUI user connection application in NebBeans 5.5 accessing mySql database in the company server. The application run very well in desktop.
However, when I post it to the company server web, it gets nothing from the database.
Can any one give advice???
Thank you in advance.
The following is my application
import java.util.Vector;
import java.awt.event.*;
import java.awt.*;
import java.awt.event.*;
public class UserConnection extends javax.swing.JFrame {
//constants for database
private final String userName = "labmanage";
private final String password = "labmanage";
private final String server = "jdbc:mysql://svr.corp.com/labmanage";
private final String driver = "com.mysql.jdbc.Driver";
private JDBCAdapter data = new JDBCAdapter(server, driver, userName, password);
//variables
private String user, pwd;
private Vector<Vector<String>> userTable = new Vector<Vector<String>>();
private Vector<String>colUserNames = new Vector<String>();
* Creates new form UserConnection
public UserConnection() {
initComponents();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
userLabel = new javax.swing.JLabel();
pwdLabel = new javax.swing.JLabel();
userTextField = new javax.swing.JTextField();
passwordField = new javax.swing.JPasswordField();
submitButton = new javax.swing.JButton();
statusLabel = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
statusTextArea = new javax.swing.JTextArea();
changePwdButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("User's Connection");
setBackground(new java.awt.Color(153, 204, 255));
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setFont(new java.awt.Font("aakar", 1, 12));
userLabel.setText("User Name:");
pwdLabel.setText("Password:");
submitButton.setText("Submit");
submitButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
submitButtonMouseClicked(evt);
submitButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
submitButtonActionPerformed(evt);
submitButton.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
submitButtonKeyTyped(evt);
statusLabel.setText("Status:");
statusTextArea.setColumns(20);
statusTextArea.setEditable(false);
statusTextArea.setLineWrap(true);
statusTextArea.setRows(3);
statusTextArea.setText("Initial assigned password is \"dime\".");
statusTextArea.setWrapStyleWord(true);
jScrollPane1.setViewportView(statusTextArea);
changePwdButton.setText("Change password");
changePwdButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
changePwdButtonActionPerformed(evt);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(userLabel)
.add(pwdLabel)
.add(statusLabel))
.add(35, 35, 35)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(submitButton)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(changePwdButton))
.add(passwordField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
.add(userTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE))
.addContainerGap())
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(userLabel)
.add(userTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(pwdLabel)
.add(passwordField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(statusLabel)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(15, 15, 15)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(submitButton)
.add(changePwdButton))
.addContainerGap(27, Short.MAX_VALUE))
pack();
}// </editor-fold>
private void submitButtonKeyTyped(java.awt.event.KeyEvent evt) {
if(evt.getKeyCode() == KeyEvent.VK_ENTER) {
submitButton.doClick();
submitButton.requestFocus();
changePwdButton.requestFocus();
private void changePwdButtonActionPerformed(java.awt.event.ActionEvent evt) {
String command = evt.getActionCommand();
if(command.equals("Change password")) {
passwordField.setText("");
//Get connection to the changing password panel
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ChangePassword().setVisible(true);
private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String command = evt.getActionCommand();
if(command.equals("Submit")) {
user = getUser();
pwd = getPwd();
data = new JDBCAdapter(server, driver, userName, password);
data.executeQuery("SELECT * FROM USERTABLE");
colUserNames = data.getColumnNames();
userTable = data.getDataTable();
if(colUserNames.elementAt(0).equals("")) {
statusTextArea.setText("Can not connect to database");
boolean checkUser = false;
int i = 0;
while(!checkUser && i<userTable.size()) {
if(user.equalsIgnoreCase((String) userTable.elementAt(i).elementAt(0))) {
//Find the user in database
checkUser = true;
//Check user's password
if(pwd.equals((String)userTable.elementAt(i).elementAt(1))) {
//Check for initial default password. The user is requested
//to change his password
if(pwd.equals((String) "dime")) {
statusTextArea.setText("You are requested to change your " +
"initial assigned password. Click 'Change password' please.");
else {
//Set UserConnection Panel to invisible
setVisible(false);
dispose();
//Get connection to the table
if(userTable.elementAt(i).elementAt(2).equals("0")) {
//Get connection to non-editable table
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
PVRackReportNonEdit rackReport = new PVRackReportNonEdit();
rackReport.createAndShowDialog();
else {
if(userTable.elementAt(i).elementAt(2).equals("1")) {
//Get connection to editable table
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
PVRackReport rackReport = new PVRackReport(user);
rackReport.createAndShowDialog();
//PVRackReport rackReport = new PVRackReport();
else statusTextArea.setText("You do not get approval for viewing data. " +
"Please contact the administrator for details.");
else {
passwordField.setText("");
statusTextArea.setText("Please enter corrected password or" +
"the administrator for details.");
i++;
if(!checkUser) {
passwordField.setText("");
statusTextArea.setText("Not find such user's name." +
"contact the admistrator for details.");
private void submitButtonMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new UserConnection().setVisible(true);
public String getUser() {
return userTextField.getText();
public String getPwd() {
return passwordField.getText();
// Variables declaration - do not modify
private javax.swing.JButton changePwdButton;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JPasswordField passwordField;
private javax.swing.JLabel pwdLabel;
private javax.swing.JLabel statusLabel;
private javax.swing.JTextArea statusTextArea;
private javax.swing.JButton submitButton;
private javax.swing.JLabel userLabel;
private javax.swing.JTextField userTextField;
// End of variables declaration
Here is my JDBCAdapter
package rackdemo2;
* This is an adaptor which transforms the JDBC interface
* to the PVRackTableDialogue
import java.util.Vector;
import java.sql.*;
import javax.swing.table.AbstractTableModel;
import javax.swing.event.TableModelEvent;
public class JDBCAdapter {
Connection connection;
Statement statement;
ResultSet resultSet;
Vector<String> columnNames = new Vector<String>();
Vector<Vector<String>> rows = new Vector<Vector<String>>();
ResultSetMetaData metaData;
public JDBCAdapter(String url, String driverName,
String user, String passwd) {
try {
Class.forName(driverName);
connection = DriverManager.getConnection(url, user, passwd);
statement = connection.createStatement();
catch (ClassNotFoundException ex) {
System.err.println("Cannot find the database driver classes.");
System.err.println(ex);
catch (SQLException ex) {
System.err.println("Cannot connect to this database.");
System.err.println(ex);
public void executeQuery(String query) {
if (connection == null || statement == null) {
System.err.println("There is no database to execute the query.");
return;
try {
resultSet = statement.executeQuery(query);
metaData = resultSet.getMetaData();
int numberOfColumns = metaData.getColumnCount();
// Get the column names and cache them.
// Then we can close the connection.
for(int column = 0; column < numberOfColumns; column++) {
columnNames.addElement(metaData.getColumnLabel(column+1));
// Get all rows.
while (resultSet.next()) {
Vector<String> newRow = new Vector<String>();
for (int i = 1; i <= columnNames.size(); i++) {
String tempString = resultSet.getString(i);
if(!tempString.equals("null")) {
newRow.addElement(tempString);
else {
newRow.addElement("");
rows.addElement(newRow);
//Modify dataTable to add empty row to separate chassis
if(numberOfColumns>1) {
int nRow = rows.size();
Vector<String> row = new Vector<String>();
for(int i=0; i<numberOfColumns; i++){
row.add("");
if(nRow>0 || numberOfColumns>0) {
//Adding blank row to separate chassis
int i = 0;
while(i<nRow) {
if(!rows.elementAt(i).elementAt(0).equals("")) {
if(i>0) {
rows.add(i, row);
i++;
nRow = rows.size();
i++;
close();
catch (SQLException ex) {
System.err.println(ex);
public void close() throws SQLException {
resultSet.close();
statement.close();
connection.close();
// MetaData
public Vector<String> getColumnNames() {
return columnNames;
public Vector<Vector<String>> getDataTable() {
return rows;
public int getColumnCount() {
return columnNames.size();
// Data methods
public int getRowCount() {
return rows.size();
}Thank you for your answer.
I'm very new to mySql as server. When I was assigned
to write the application, the administrator has set
up mySql database in the company web server for my
application. My program runs very when using my
workplace desktop with java web start or with java
web start in netbeans (all paths should be link to my
desktop hard disk, i.e. users/application/). I can
not run the application at home because I can not
access to the company intranet server (for security
purpose). The problem happens when I post the
application in the company web page (I have to modify
all paths in jnlp file to the company web address).
The program then runs without exception except it
seems that it gets no data from the database (for
example, when I type my username, it returns that
"There is no such user name. contact.." as what I
code in the application for not correcting user name)
It happens for not only using my company desktop but
also for others.
Please help me.
Thank you in advance.And all this could have been answered yesterday, in your other thread, when I asked you "Is the DB configured to allow that user to connect to the DB from where that user is attempting to connect from?"
Seeing as how you get that error, the obvious answer was, "No." At which point we could have continued.
Configure the needed users into the DB, without forgetting to allow them access from the machines from which they are going to access from.
Although, I agree with Rene, that you should set up a server of some sort, located on the same machine as the DB, for communicating with the DB. -
Simplify the select query to get single record
Please let me know what is wrong with my query.
Max(p_received_date) is returning null columns too. But i need to have only null record per period, if there is date and null record for the same billing then return the date record. please check november and september records. september should return only 09/13/10 record but it is returning null record too. please help to get expected out put.
SELECT DISTINCT B_BILLING_KEY,
to_char(to_date('01/'||trim(substr(B_REPORT_PERIOD,5,2))||'/'||
trim(substr(B_REPORT_PERIOD,1,4)),'DD/MM/YYYY'),'Month YYYY') Billing,
B_company_id company,
sum((nvl(T.B_ORG_SURCH_AMOUNT,0)+nvl(T.B_ORG_PI_AMOUNT,0))-(nvl(T.P_AMOUNT,0))) "PeriodBalance",
Max(to_char(P_RECEIVED_DATE,'MM/DD/YY')) LastPaymentDate,
decode(sign(
(nvl(T.B_ORG_SURCH_AMOUNT,0)+nvl(T.B_ORG_PI_AMOUNT,0))-(nvl(T.P_AMOUNT,0))), 1,'Yes','No') Outs
FROM mv_program_dict P, tuff_balance_view T WHERE
b_company_id = 'U-7052-C' group by B_REPORT_PERIOD,B_company_id,B_BILLING_KEY,B_ORG_SURCH_AMOUNT,
B_ORG_PI_AMOUNT,P_AMOUNT
order by B_BILLING_KEY desc
Actual
Billing key Billing company periodbalance lastpayment date outs
110631534073 November 2010 U-7052-C 270 Yes
110631534073 November 2010 U-7052-C 690 Yes
110631534073 November 2010 U-7052-C 66 Yes
110461533197 October 2010 U-7052-C 4740 Yes
110461533197 October 2010 U-7052-C 27000 Yes
110461533197 October 2010 U-7052-C 0 No
110251532527 September 2010 U-7052-C 0 09/13/10 No
110251532527 September 2010 U-7052-C 0 No
110251532527 September 2010 U-7052-C -18 09/13/10 No
110251532484 August 2010 U-7052-C 0 09/13/10 No
110251532484 August 2010 U-7052-C 2001 09/13/10 Yes
110251532484 August 2010 U-7052-C 0 No
Expectedoutput(need only following columns)Outs is outstanding balance
Billing key Billing company l astpayment date outs
110631534073 November 2010 U-7052-C Yes
110461533197 October 2010 U-7052-C Yes
110251532527 September 2010 U-7052-C 09/13/10 No
110251532484 August 2010 U-7052-C 09/13/10 YES
By using below query i am getting all output as NO. HOw to modify this query.
SELECT company,
billing,LastPaymentDate,
CASE
WHEN SUM (DECODE (outs, 'YES', 1, 0)) > 0 THEN 'YES'
ELSE 'NO'
END Outstanding
FROM (
SELECT DISTINCT B_BILLING_KEY,
to_char(to_date('01/'||trim(substr(B_REPORT_PERIOD,5,2))||'/'||
trim(substr(B_REPORT_PERIOD,1,4)),'DD/MM/YYYY'),'Month YYYY') Billing,
B_company_id company,
sum((nvl(T.B_ORG_SURCH_AMOUNT,0)+nvl(T.B_ORG_PI_AMOUNT,0))-(nvl(T.P_AMOUNT,0))) "PeriodBalance",
Max(to_char(P_RECEIVED_DATE,'MM/DD/YY')) LastPaymentDate,
decode(sign(
(nvl(T.B_ORG_SURCH_AMOUNT,0)+nvl(T.B_ORG_PI_AMOUNT,0))-(nvl(T.P_AMOUNT,0))), 1,'Yes','No') Outs
FROM mv_program_dict P, tuff_balance_view T WHERE
b_company_id = 'U-7052-C' group by B_REPORT_PERIOD,B_company_id,B_BILLING_KEY,B_ORG_SURCH_AMOUNT,
B_ORG_PI_AMOUNT,P_AMOUNT
order by B_BILLING_KEY desc)
GROUP BY company, billing,LastPaymentDate;
Note:in the actual out put max(lastpayment date) is returing null values. if there is any date in one billing return that date only remove null example is september. in september it should return only 09/13/10 this date not null date. but if there is no other within one biling then consider that as null example november..
Thanks,
vAnother solution is setting NLS_SORT to CI - case insensitive (or whatever_your_language_is_CI) and NLS_COMP to ANSI:
SQL> with t as (
2 select 'HARI' name from dual union all
3 select 'Hari' name from dual union all
4 select 'HaRi' name from dual
5 )
6 select *
7 from t
8 where name = 'hArI'
9 /
no rows selected
SQL> alter session set nls_sort = binary_ci
2 /
Session altered.
SQL> alter session set nls_comp=ansi
2 /
Session altered.
SQL> with t as (
2 select 'HARI' name from dual union all
3 select 'Hari' name from dual union all
4 select 'HaRi' name from dual
5 )
6 select *
7 from t
8 where name = 'hArI'
9 /
NAME
HARI
Hari
HaRi
SQL> SY.
Maybe you are looking for
-
Can I install an 8Gb Ram Module on a 2010 Imac?
Acording to apple support iMac (Mid 2010): Memory specifications - Apple Support, "You can use RAM module sizes of 2 GB or 4 GB in each slot", but clearly is more cost efficient to be able to install an 8Gb and a 4Gb, as the iMac already comes with t
-
Hi there, I had Oracle 8.1.6 on my Windows ME. Now I have Windows XP, and oracle is not working. Are there any downloads to upgrade my Oracle 8.1.6 in order to work on XP?
-
I want to develop an distributed application using multicast communication. For this I choose to usse the new IO APi(java.nio) but I have a problem. All the samples with this API show how to use ServerSocketChannels and SocketChannels. Can someone sh
-
How do I create an automatic loop for a DVD I want to show play over and over in Encore? thanks for your help!
-
Cannot Open Oracle XE DB-Homepage
After installing Oracle 10g XE on a Windows XP Pro, I can't open the DB Homepage. I miss the listening process for port 8080. I've got no problems on another XP Installation on my Laptop, but it does not work on my workstation The services are runnin