How to split string in data table row in c#
hi,
Binding List data in to data table,. in that table i have description column. this column data move to data table in sql server
here we facing problem for Description column
the description column having data is
<div class="ExternalClassE4908D8C25DF4D1586D0A010BFBC5A53">3400</div>
now we want only 3400 values i am using this code
ring Descrption = rows["Description"].ToString();
if (! string.IsNullOrEmpty(Descrption))
char[] splitString = new char[] { '<', '>' };
string[] parts = Descrption.Split(splitString,
StringSplitOptions.RemoveEmptyEntries);
// string[] Dec_1 = Dec.Split(new char[] { '<' }, StringSplitOptions.RemoveEmptyEntries);
rows["Description"] = parts[1].ToString();
Hope the below helps as start..Modify
//Option1
Descrption = Descrption.Substring(0, Descrption.LastIndexOf("<"));
Descrption = Descrption.Substring(Descrption.LastIndexOf(">") + 1);
Console.WriteLine(" {0} ", Descrption);
//Option2
Console.WriteLine(" {0} ", Regex.Replace(Descrption, "<[^>]*>", string.Empty));
accordingly..
Similar Messages
-
Hi,
How to find the average of table row values it should display in next row in libwindow/CVI
Please let me know the solution.There isn't a built-in function to perform calculations on thable cells. What you can do is to retrieve thable cells values and calculate the average by yourself.
To retrieve a bunch of cells in a single instruction you can use GetTableCellRangeVals: prerequisite for this function to work correctly is that cells are all included in a Rect structure (shortly, a rectangle) and are all of the same data type. See the help for the function for some explanations and the link to an example of its usage. In Cell range parameter you can pass VAL_TABLE_ROW_RANGE (row) macro to retrieve an entire row. See here for details.
Once you have retrieved cell values in an array, you can pass it to Mean function to calculate the average.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
How to parse string to date in j2me?
How to parse string to date in j2me?
Please help me.Hi..
String dyStr = "20";
String mtStr = "1";
String yrStr = "1999";
Calendar cal = Calendar.getIntstance();
int dy = Integer.parseInt(dyStr);
int mt = Integer.parseInt(mtStr);
int yr = Integer.parseInt(yrStr);
cal.set(Calendar.DATE, dy);
cal.set(Calendar.MONTH, mt);
cal.set(Calendar.YEAR, yr);
OK? -
Can please tell me how to implement expand and collapse table row data?
i am trying implement expand and collapse table row data but i do not get any ideas..can please any one help me its an urgent requirement
Yes, we can.
I think the best place for you to start for this is the NI Developer Zone. I recommend beginning with these tutorials I found by searching on "data log rio". There were more than just these few that might be relevant to your project but I'll leave that for you to decide.
NI Compact RIO Setup and Services -> http://zone.ni.com/devzone/cda/tut/p/id/11394
Getting Started with CompactRIO - Logging Data to Disk -> http://zone.ni.com/devzone/cda/tut/p/id/11198
Getting Started with CompactRIO - Performing Basic Control -> http://zone.ni.com/devzone/cda/tut/p/id/11197
These will probably give you links to more topics/tutorials/examples that can help you design and implement your target system.
Jason
Wire Warrior
Behold the power of LabVIEW as my army of Roomba minions streaks across the floor! -
How to get String form java JTable row?
Hello everybody,
Can anybody tell me how to get value as String form java JTable row?I found solution:
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent evt) {
if (evt.getClickCount() == 2){
int col = table.getSelectedColumn();
int row = table.getSelectedRow();
String tableUrl = ((String)table.getModel().getValueAt(row, col));
ur.openUrl(tableUrl);
}); -
How to generate a waveform data table for my data acquisition (GPIB)?
Hi everyone, I'm new to labview. I have a question, how to obtain waveform data(an I/O file so I can plot it in graphic software), rather than just plot a waveform graph which is pretty easy, but I want a waveform data table, how can I do that? Thank you very much!
Message Edited by pack2themoon on 12-12-2008 10:05 PMWell, I would tell you how to get the data to display on a table however then you will come to another issue.
The issue is that once the data is in a table, you cannot select all the data at once.
You can only select one cell at a time, I'm not sure why, guess it was an oversight of some kind.
There are a few work arounds, and if you are still interested in this aprroach, I will share them with you.
Cory K -
How put a border round a table row?
I have a simple table, and want to put a border round each row - for some reason nothing I do works. I would also like a large space between rows than between the individual cells but again can't work out how to do it.
Can anyone help?Just to close this thread, I'll show how I would do it -
<style type="text/css">
table {
border-collapse:collapse;
.row td, .row th {
border:solid #000;
border-width:1px;
.row td+td {
border-right:none;
border-left:none;
.row td.last {
border-right:1px solid #000;
.row>td {
border-right:none;
</style>
</head>
<body>
<table>
<tr class="row">
<td>asdfg</td>
<td>asdfg</td>
<td>asdfg</td>
<td class="last">asdfg</td>
</tr>
</table>
</body>
This is interesting because it illustrates the use of the adjacent siblings selector and the first descendent selector. What's slick is if you know how many cells there are in the row, you could do it this way and bypass the creation of that extra class selector (td.last) -
<style type="text/css">
table {
border-collapse:collapse;
.row td, .row th {
border:solid #000;
border-width:1px;
.row td+td {
border-right:none;
border-left:none;
.row td+td+td+td {
border-right:1px solid #000;
.row>td {
border-right:none;
</style>
</head>
<body>
<table>
<tr class="row">
<td>asdfg</td>
<td>asdfg</td>
<td>asdfg</td>
<td class="last">asdfg</td>
</tr>
</table>
</body> -
How to parse string to date with defualt format?
is there any possibilities to parse a string to date if we don't specify the format in SDF?
In database we have different formats and we need to convert each one convert to date with common format(something like default), is there any possibilities to do in java?jwenting wrote:
Tolls wrote:
ColinAtWork wrote:
SumantK wrote:
In database we have different formats and we need to convert each one convert to date with common format(something like default), is there any possibilities to do in java?Why don't you store the date in the database as a DATE datatype then you can format anyway you like??Because some people seem to fear DATEs and prefer the supposed comforts of a VARCHAR2...after all, who knows what murky goings on occur with a DATE, but at least a VARCHAR2 is readable, or something like that anyway.Just because some people don't know how to work with DATE fields (which is the real reason for their "fear" doesn't mean you shouldn't use them.
They're the appopriate solution, so use it.Often but not always true.
For example neither MS SQL Server nor Oracle timestamp types will store the resolution capable with the Java Date type. So if one wants to maintain all of that resolution one requires either a varchar or two columns.
And although I haven't been able to confirm it (recently at least) at one time one of the Oracle drivers had a bug that a timestamp would wipe out following columns. For that one either one was left with having only a single timestamp as the last column or using a varchar. -
Hi,
I have a string with fields each of length 40, I need to split it at the mutilples of 40 and put in an internal table , i.e.
field1(40),
field2(40),
field3(40)
v_str = (field1 field2 field3 .. ).
thanks
points will rewardedDATA: s1 TYPE string,
s2 TYPE string,
s3 TYPE string,
it_tab TYPE TABLE OF string,
text = ` ur text `.
SPLIT text AT ',' INTO: s1 s2 s3,
TABLE it_tab.
Regards,
Jagadish -
How to get the index of table row without selection?
Hi all,
I have an table designed in XML view.Now i have added an change method for qty cell "valqty". When user inputs the qty in the cell and press enter this method is triggered now I want to know which index of the table is currently edited.Through which i can get the value of other cell in the same row.
NOTE: The table row doesn't have selection either multiple or single
I tried the following inside the valqty method but it now working
this.getValue();
this.getBindingContext().getProperty('PRD_NUM');
<Table id="idProductsTable"
inset="false"
items="{oModel>/deliverylist}"
visibleRowCount= "7"
mode="MultiSelect"
modeAnimationOn="true">
<headerToolbar>
<Toolbar>
<Label text="Products"></Label>
</Toolbar>
</headerToolbar>
<columns>
<Column
minScreenWidth="Tablet"
demandPopin="true">
<Text text="Order" />
</Column>
<Column
minScreenWidth="Tablet"
demandPopin="true">
<Text text="Quantity" />
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{oModel>PRD_NUM}" />
<Input value="{oModel>DEL_QUAN}" change="valqty" maxLength="13" />
</cells>
</ColumnListItem>
</items>
</Table>
ThanksThanks Robin,
But in my case oEvent.getSource() is returning the cell instance and
oEvent.getSource().getBindingContext() is undefined
Hence not getting the value
I also tried the following
oEvent.getSource().getParent().getParent().indexOfItem()
But index returned is -1 -
How to use colspan in data table?
I have a requiremnt like using colspan in data table.
I heared it is possible with some javascripting code . I s it true.
If possible pleese send that code.It's just free to use? Or are you violating the Apache license somehow?
Well, the best solution turns out to create a custom component.
You can also try to group/render a h:panelGrid in a h:column to simulate multiple columns. This might involve some rework with the layout (CSS should be sufficient tho) and the generated code would look like dirty. But this should work anyhow. -
How to copy data, table rows between tables in different schema
how do I copy rows from one table in one schema into another table in another schema in same database?
Hi,
Give an Access to the respective table in Source Schema to Destinations Schema. If table does not exits in the destination schema use CTAS else Insert into..etc., with your select Query.
- Pavan Kumar N -
How to split strings into columns
Hi guys,
I have a select like this:
select 'testing1'||'.'||'testing2'||'.'||'testing3' from dualwhich gives me an output like this:
testing1.testing2.testing3How can I split this into 3 columns in SQL PLUS?
Thank you in advanceuser643734 wrote:
Thank you guys for all your help.
Hi,
I tried to resolve your problem using somme functions...
I know is a long, long story but it works.
Regards,
Ion--create table_pivot
CREATE TABLE pivot_table(id VARCHAR2(1) primary key, all_concat VARCHAR2(1810));
--add data
insert into pivot_table (id, all_concat) values('x','12345.2829303132.234234.234234.234234');
insert into pivot_table (id, all_concat) values('y','67890.2324252627.234234.234234.234234.332545');
insert into pivot_table (id, all_concat) values('z','11121314.12345.234234.234234.234234.23432.32453245.345435.345435');
insert into pivot_table (id, all_concat) values('a','151617.67890.234234.234234');
insert into pivot_table (id, all_concat) values('b','1819202122.1112131415.234234.234234.234234.345435');
insert into pivot_table (id, all_concat) values('c','2324252627');
insert into pivot_table (id, all_concat) values('h','2829303132.234234.234234.234234.23432.32453245.345435.345435.4325435.345');
insert into pivot_table (id, all_concat) values('r','');
set termout off
--procedures and functions to compile
--1. Main function to format strings
create or replace function fgetformatstring
(v_max_rows numeric, v_crt_row varchar2, v_table_source varchar2, v_save_to_table varchar2, v_option numeric)
return varchar2
is
v_crt_char numeric:=0;
v_pos_char numeric:=1;
v_count numeric:=0;
v_string_out varchar2(500);
v_str_paded varchar2(10):=',null';
v_length_pad numeric;
v_diff_pad numeric;
l_crt_row varchar2(1800);
v_char char:=',';
v_delimiter char:='.';
l_save_to_table varchar2(1000);
l_max_rows numeric;
begin
l_crt_row:=replace(v_crt_row,'.' ,',');
l_save_to_table:=v_save_to_table;
l_max_rows:=v_max_rows;
if v_option=0 then --get the ',null' to paded in pivot_table
loop
v_pos_char:=v_crt_char;
v_crt_char:=instr(v_crt_row,v_char, v_crt_char+1);
v_count:=v_count+1;
exit when v_crt_char=0 or v_count=1000;
end loop;
v_string_out:=' ';
v_count:=v_count-1;
v_diff_pad :=l_max_rows-1-v_count;
if v_diff_pad >0 then --nothing to add
v_length_pad:=length(v_str_paded);-- (+v_char)
v_length_pad:=v_diff_pad*v_length_pad;
v_length_pad:=v_length_pad+1;
v_string_out:=rpad(v_string_out,v_length_pad,v_str_paded);
end if;
end if;
if v_option=1 then --get definition of v_save_to_table
v_count:=1;
v_string_out:=' ';
loop
exit when v_count=l_max_rows+1 or v_count>=1000;
v_length_pad:=length(v_string_out||'col'||to_char(v_count)||',');
v_string_out:=rpad(v_string_out,v_length_pad,'col'||to_char(v_count)||',');
v_count:=v_count+1;
end loop;
v_string_out:=trim(v_char from v_string_out);
--v_string_out:='id,'||v_string_out;
v_string_out:=v_string_out;
end if;
if v_option=2 then --get position of last comma
loop
v_pos_char:=v_crt_char;
v_crt_char:=instr(v_crt_row,v_char, v_crt_char+1);
v_count:=v_count+1;
exit when v_crt_char=0 or v_count=1000;
end loop;
v_string_out:=substr(v_crt_row,1,v_pos_char-1);
end if;
if v_option=3 then --get numbers of delimiters(.)
loop
v_pos_char:=v_crt_char;
v_crt_char:=instr(v_crt_row,v_delimiter, v_crt_char+1);
--dbms_output.put_line( 'Rows: ' ||v_crt_row|| ' iteration: '||v_count);
v_count:=v_count+1;
exit when v_crt_char=0 or v_count=1000;
end loop;
v_count:=v_count;
v_string_out:=to_char(v_count);
end if;
if v_option=4 then --get sql command to create v_save_to_table
v_count:=1;
v_string_out:=' ';
loop
exit when v_count=l_max_rows+1 or v_count>=1000;
v_length_pad:=length(v_string_out||'col'||to_char(v_count)||' varchar2(40), ');
v_string_out:=rpad(v_string_out,v_length_pad,'col'||to_char(v_count)||' varchar2(40), ');
v_count:=v_count+1;
end loop;
v_string_out:=trim(' ' from v_string_out);
v_string_out:=trim(v_char from v_string_out);
v_string_out:='create table '|| l_save_to_table ||'('||v_string_out||')';
end if;
if v_option=5 then --get numbers of delimiters(,)
loop
v_pos_char:=v_crt_char;
v_crt_char:=instr(v_crt_row,',', v_crt_char+1);
v_count:=v_count+1;
exit when v_crt_char=0 or v_count=1000;
end loop;
v_count:=v_count-1;
v_string_out:=to_char(v_count);
end if;
dbms_output.put_line( 'string: ' ||v_string_out|| ' option: '||v_option);
return v_string_out;
end;
--2.get max items
create or replace function fgetmaxitems
--get the max number of items founded in the pivot_table.all_concat
--before change the points with comma
return numeric
is
v_max numeric:=0;
v_field pivot_table.all_concat%type;
v_crt_max numeric:=0;
v_crt_row varchar(1000);
cursor c1 is
select all_concat from pivot_table;
begin
v_crt_max:=0;
v_max:=0;
open c1;
loop
fetch c1 into v_field;
exit when c1%notfound;
v_crt_row:=v_field;
v_crt_max:=fgetformatstring(0,v_crt_row,'pivot_table','',3);
if v_crt_max>v_max then
v_max:=v_crt_max;
end if;
end loop;
close c1;
return v_max;
end;
--3. insert the rows in table_dest
create or replace procedure pinsertrow
v_max_rows numeric,
v_all_concat varchar2,
v_source_table_name varchar2,
v_save_to_tablename varchar2
is
v_sql_string varchar2(1000);
l_all_concat varchar2(1500);
begin
l_all_concat:=replace(v_all_concat,'.' ,',');
v_sql_string:='('||l_all_concat||')';
v_sql_string:=' insert into ' ||v_save_to_tablename
||' (' ||fgetformatstring(v_max_rows,l_all_concat,v_source_table_name,v_save_to_tablename,1)||')'||
' values'||v_sql_string ;
execute immediate v_sql_string;
end;
--4.procedure to create dinamically <table_dest>
create or replace procedure pcreatesavetable
(v_table_source varchar2, v_save_to_table varchar2)
is
v_sql_string varchar2(1000);
already_exists exception;
pragma exception_init(already_exists,-955);
v_max numeric;
begin
--clear empty values;
v_sql_string:='delete from ' ||v_table_source|| ' where length(all_concat)=0 or (all_concat) is null';
execute immediate v_sql_string;
v_sql_string:='';
v_max:=fgetmaxitems;
--create new table
v_sql_string:=fgetformatstring(v_max,'all_concat', v_table_source,v_save_to_table,4);
dbms_output.put_line( 'sql create : '|| v_sql_string);
execute immediate v_sql_string;
exception
when already_exists then
--delete old table
v_sql_string:='drop table ' ||v_save_to_table;
execute immediate v_sql_string;
--create new table
v_sql_string:=fgetformatstring(v_max,'all_concat', v_table_source,v_save_to_table,4);
dbms_output.put_line( 'sql recreate final_table : '|| v_sql_string);
execute immediate v_sql_string;
end;
--5.main procedure
create or replace procedure pmainproc(v_save_to_table varchar2)
is
v_key_pivot pivot_table.id%type;
v_column_pivot pivot_table.all_concat%type;
v_max numeric;
v_crt_row varchar2(1600);
cursor c2 is select y.id , y.all_concat
from pivot_table y
; --cursor upon pivot_table
begin
v_max:=fgetmaxitems;
if v_max <> 0 then
--clear empty values;
delete from pivot_table where length(all_concat)=0 or (all_concat) is null;
--change all points with comma
update
(select x.id, x.all_concat from pivot_table x, pivot_table y where x.id=y.id) b
set b.all_concat=replace(b.all_concat,'.', ',');
-- padd the all_concat with ',null'
update
(select x.id, x.all_concat from pivot_table x, pivot_table y where x.id=y.id and
fgetformatstring(v_max,x.all_concat,'pivot_table',v_save_to_table,5) <> v_max
) b
set b.all_concat=b.all_concat || fgetformatstring(v_max,b.all_concat,'pivot_table',v_save_to_table,0);
--remove last
update pivot_table
set all_concat= fgetformatstring(v_max,all_concat,'pivot_table',v_save_to_table,2)
where fgetformatstring(v_max,all_concat,'pivot_table',v_save_to_table,5) = v_max;
open c2;
loop
fetch c2 into v_key_pivot, v_column_pivot;
exit when c2%notfound;
v_crt_row:=v_column_pivot;
-- insert data in to final_table
pinsertrow(v_max,v_crt_row,'pivot_table',v_save_to_table);
end loop;
close c2;
end if;
end;
--create table_dest
--the table_dest will be created automatically, so you need admin privilege to run that before compile pcreatesavetable :
connect / as sysdba or connect system/password
--grant create table to hr;
--conne hr/hr;
exec pcreatesavetable('pivot_table','table_dest');
--add data to table_dest
exec pmainproc('table_dest');
set termout on
select * from table_dest;
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
Function created.
Function created.
Procedure created.
Procedure created.
Procedure created.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
COL1 COL2 COL3 COL4 COL5 COL6 COL7 COL8 COL9 COL10
12345 2829303132 234234 234234 234234
67890 2324252627 234234 234234 234234 332545
11121314 12345 234234 234234 234234 23432 32453245 345435 345435
151617 67890 234234 234234
1819202122 1112131415 234234 234234 234234 345435
2324252627
2829303132 234234 234234 234234 23432 32453245 345435 345435 4325435 345
7 rows selected. -
Hi,
I have created a table with 2 LOV's , LOV2 is dependent on LOV2.
Here I can not use the general Dependent LOV concept, as these values are coming from 2 different LookUps.
I am not able to fetch the user input for LOV1 (from page) .that is why not able to set the where cluse fro 2nd LOVVO.
I have used this code:
if ("ViolationCat".equals(lovInputSourceId)) {
OAMessageLovInputBean msglov =
(OAMessageLovInputBean)webBean.findChildRecursive("ViolationCat");
// String p_violation_category = "'"+(String)msglov.getValue(pageContext)+"'";
String p_violation_category =
(String)msglov.getValue(pageContext);
// System.out.println(" p_violation_category =" +
// p_violation_category);
String v_violation_category = "";
//System.out.println("vcat=" + vCat);
OAViewObject violationVO =
(OAViewObject)am.findViewObject("SNI_Violation_DtlsVO2");
Number vcatViolationIdnum =
(Number)violationVO.getCurrentRow().getAttribute("ViolationId");
String vcatViolationId = "" + vcatViolationIdnum;
pageContext.putTransactionValue("vcatViolationId",
vcatViolationId);
pageContext.putTransactionValue("p_violation_category",
p_violation_category);
String query =
" SELECT LOOKUP_CODE, \n" + " MEANING, \n" +
" LOOKUP_TYPE \n" +
" FROM apps.fnd_lookup_values \n" +
" WHERE LOOKUP_TYPE ='SNI_VIOLATION_CATEGORY' AND MEANING=?";
PreparedStatement ps = txn.createPreparedStatement(query, 1);
try {
ps.setString(1, p_violation_category);
ResultSet rs = ps.executeQuery();
//System.out.println("before while,");
// rs.next();
// v_violation_category = rs.getString("LOOKUP_CODE");
// System.out.println("v_violation_category="+v_violation_category);
while (rs.next()) {
//System.out.println("inside while");
v_violation_category = rs.getString("LOOKUP_CODE");
// System.out.println("v_violation_category=" +
// v_violation_category);
ps.close();
} //try ends
catch (Exception e) {
e.getMessage();
//System.out.println("in catch.." + e.getMessage());
OAViewObject subCatVO =
(OAViewObject)am.findViewObject("SNI_ViolationSubCategoryVO1");
//System.out.println("get VO before where clause: subCatVO::"+subCatVO.getQuery());
subCatVO.setWhereClause("LOOKUP_TYPE like '%SNI_VIOL_SUB_CAT_" +
v_violation_category + "'");
System.out.println("after set where clause VO: subCat VO::" +
subCatVO.getQuery());
subCatVO.executeQuery();
// System.out.println("query of subCat VO::" +
// subCatVO.getQuery());
//End of sub category Validation
It is working fine only for the 1st row of teh table.
I have tried to fetch the value using :
String violationCategory = (String)violationVO.getCurrentRow().getAttribute("ViolationCategory");
String violationSubcategory = (String)violationVO.getCurrentRow().getAttribute("ViolationSubcategory");
But it is fetching null value.
Please tell me how can I able to fetch the values.Hi
in your scenarion,first u have to identify the particular row of table where the changes is being made ,u have to use this code .when u select the lov ,first it will give the row refernce and then u have to catch the lov event
OAApplicationModule am =
(OAApplicationModule)pageContext.getApplicationModule(webBean);
String event = pageContext.getParameter("event");
if ("<ItemPPREventName>").equals(event))
// Get the identifier of the PPR event source row
String rowReference =
262
pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
Serializable[] parameters = { rowReference };
// Pass the rowReference to a "handler" method in the application module.
am.invokeMethod("<handleSomeEvent>", parameters);
In your application module's "handler" method, add the following code to access the source row:
OARow row = (OARow)findRowByRef(rowReference);
if (row != null)
thanx
Pratap -
How to convert String to date ? - MS access
I want to convert a string "10-10-08" [ MM-dd-yy ] into date type in same format to use that in query statement [MS Access].
In table , I am using field called "date" with "MM-dd-yy" format.
Example:
<%@ page import= "java.sql.*"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ page import="java.util.Date"%>
<%
String d="10-9-08";
SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yy");
Date date = dateFormat.parse(d);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb");
Statement st = con.createStatement();
ResultSet rs=st.executeQuery("Select * from datacollectdb where date='"+date+"'");
%>
I am getting "java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
" error.
How to use the string "10-10-08" in where statement?sangee wrote:
I want to convert a string "10-10-08" [ MM-dd-yy ] into date type in same format to use that in query statement [MS Access].
In table , I am using field called "date" with "MM-dd-yy" format.I think a column named "date" is a very bad idea. Not just because "date" is a keyword. It's not very self-describing. How about "birth_date" or "hire_date" or "went_on_my_first_date"?
Example:Scriptlets? There's your second mistake.
<%@ page import= "java.sql.*"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ page import="java.util.Date"%>
<%
String d="10-9-08";The way you're doing things, "2-40-99" is a valid date. Is that what you want?
SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yy");
Date date = dateFormat.parse(d);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb");Wrong again. Better to use a PreparedStatement and bind that Date.
Statement st = con.createStatement();
ResultSet rs=st.executeQuery("Select * from datacollectdb where date='"+date+"'");
%>
I am getting "java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
" error.
How to use the string "10-10-08" in where statement?Use PreparedStatement and bind.
Your JSP should not be getting a database connection. Pool it.
Your code is wrong on every level. You don't close resources, you don't separate you app into layers, your database code is not in a POJO. I'd recommend that you throw this away and start again.
%
Maybe you are looking for
-
My Mac has blue screened a couple of times this week it started to work a couple of times after that but now it is grey screening with inch wide blue lines from top to bottom the apple logo is also there it is trying to boot up again but won't. Not s
-
What are the major differences one should consider when developing web pages using creator with the above mentioned browsers?This I guess can be an ongoing thread.I thought its worth poolin gin some thoughts. Thanks.
-
Removing the Control Characters from a text file
Hi, I am using the java.util.regex.* package to removing the control characters from a text file. I got below programming from the java.sun site. I am able to successfully compile the file and the when I try to run the file I got the error as -------
-
Organizational structure in WM (Warehouse management)
Hi, could You please explain me what is the organizational structure in WM? Best regards
-
Defalt values in material master?
Hi All, Is it possible to make default values in material master. Like material group should be 001 for material type ROH etc Regards, RR