Inserting field text into sql query and comparing values to another table
I have an issue in Visual Web Developer 2010 that I need help with.
The code below is a Gridview Sql query where I'm extracting PART_NUMBER from various tables. I would like to add the table name in a separate field named Table. The end result should appear as follows:
PART_NUMBER Table
010-0075-06 Resistors (or Capacitors, etc.)
Sql query:
SELECT PART_NUMBER
FROM Capacitors
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Connectors
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Diodes
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM ICs
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Inductors
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Misc
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Relays
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Resistors
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Switches
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Transformers
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM Transistors
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
UNION
SELECT PART_NUMBER
FROM [Crystals and Oscillators]
EXCEPT
SELECT PART_NUMBER
FROM [CIS Manufacturer Parts]
ORDER BY PART_NUMBER
I have a separate table (CIS Manufacturer Parts) that contains manufacturer data for the above parts. Multiple manufacturer rows can exist. The connection between tables in the PART_NUMBER field. What I would like to do is make this query
add the table name to the gridview output listing only parts without manufacturer data and the table they can be found in.
This is a lot for a newbie so I will appreciate any help, thanks!
Hello Bulldog248,
Thank you for your post.
Your issue is out of support range of VS General Question forum which mainly discusses the usage issue of Visual Studio IDE such as
WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
and Visual Studio Editor.
I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum.
Best regards,
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
-
How to make validation in Bean and select value from another table
I want to know how to select data from table in backing bean according to primary key i have
the problem is that
i have a table Employee_Salary contains Employee ids and their salary
Empoloyee_Salary table
Employee_ID Number
Employee_salary Number
And Another table Called Employees
Employees table
Employee_ID Number
IsManager Varchar2 its value is [*Yes or NO*]
and other columns that i don't care about this table
i have on a jsff page an <af:table> this table is editable this is the Empoloyee_Salary table
*i want to check before save or after insert if this employee is Manager [from Employees tabke(yes or no)] the salary*
cannot be less that 100
i want to know how to make this how to select the value from employees table according to the id i have in the employee_salary table how to make this and make this validation
i have to select IsManager from Employees Table to see if this manager or no
i want to know how to make this in a bean
i use jdeveloper 11g
and my project is ADF Fusion project
and the page that have the Emplpyee_Salary table is JSFF
thanks in advanceYou might want to write this code in a validator on the entity object if it should apply from every screen.
If you want to access view objects from a backing bean the basics are here: http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcservices.htm#sthref918 -
How to insert the records using sql query
hi,
i insert the record uisng sql query and DOTNET programme successfully and increase the doc num .ubut when i try to add record using SAP B1 the old Doc no show.It means its not consider the docnums which are not inserted by sql query.
how can i solve this problem?
Regards,
M.Thippa ReddyYou are not support use Insert / Update / Delete on SAP Databases directly.
SAP will not support any database, which is inconsistent, due to SQL-Queries, which modify datasets or the datastructure of the SAP Business One Database. This includes any update-, delete- or drop-statements executed via SQL-Server Tools or via the the query interface of SAP Business One
Check SAP Note: 896891 Support Scope for SAP Business One - DB Integrity
[https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E¬e_numm=896891] -
Need help in SQL Query: Update a row in a table & insert the same row into another table
I want to update a row in a table say Table A and the updated row should be inserted into another table say Table B. I need to do it in a single SQL query and i don't want to do it in PL/SQL with triggers. And i tried with MERGE statement but its working with this scenario. (Note: I'm using Oracle Database 10g Enterprise Edition Release 10.2.0.1.0).
Thanks in Advance.Using Sven's code as an example, you could save the updated row in a sql plus variable. (also untested):
SQL> var v_id number
update tableA
set colB='ABC'
where colC='XYZ'
returning id into :v_id;
insert into table A_History (ID, colA, colB, ColC)
select id, ColA, ColB, ColC
from tableA
where id = :v_id; -
Automated insertion of text into Sales order header
Hi Guru's,
we are recently working on specific request for automated creation of sales documents.
On each sales order there is a need to update specific fields on header level with default values - no problem.
There is also need to insert specific text into Header text: "Service reendered YYYY-MM-DD" into each single order generated by this automated way.
Do you know any functionality that we can implement into our solution or any other solution which is coming to your mind?
THANK YOU!!!Hi
Please try with the following user exits.
USEREXIT_MOVE_FIELD_TO_TVCOM_H
You can use this user exit to influence text determination for header texts. For example, you can include new fields for text determination or fill fields that already exist with a new value.
USEREXIT_MOVE_FIELD_TO_TVCOM_I
You can use this user exit to influence text determination for item texts. For example, you can include new fields for text determination or fill fields that already exist with a new value.
Regards,
P Gomatheeswaran. -
Is it possible to apply conditional formatting to a cell (or range) based upon a LOOKUP query to cell values in another sheet.?
I want to alter the formatting (i.e., text and/or cell background color), but not the content, of the target cell(s).Hi Tom,
Your LOOKUP formula will return a value that it finds in the "other" table. That value can be used in conditional highlighting rules. (Numbers 3 calls it conditional highlighting, not conditional formatting. Just to keep us awake, I guess, but it works the same).
Please explain what you are trying to do.
Regards,
Ian. -
Finding the Text of SQL Query causing Full Table Scans
Hi,
does anyone have a sql script, that shows the complete sql text of queries that have caused a full table scan?
Please also let me know as to how soon this script needs to be run, in the sense does it work only while the query is running or would it work once it completes (if so is there a valid duration, such as until next restart, etc.)
Your help is appreciated.
Thx,
MayuranFinding the Text of SQL Query Causing Full Table Scan
-
Each time I type an apostrophe on pages it comes out as a divide sign and alters any preceding italicised text into meaningless letters and numbers. How do I change this?
Does this still happen if you set your font to Lucida Grande?
Could you use the camera icon here to post a screen shot of how this looks with the meaningless letters and numbers? -
I have inserted a DVD into my minimac and now it won't eject. Is there an override for this?
Try this discussion > https://discussions.apple.com/message/19931572
-
How could I replace hard coded value in my sql query with constant value?
Hi all,
Could anyone help me how to replace hardcoded value in my sql query with constant value that might be pre defined .
PROCEDURE class_by_day_get_bin_data
in_report_parameter_id IN NUMBER,
in_site_id IN NUMBER,
in_start_date_time IN TIMESTAMP,
in_end_date_time IN TIMESTAMP,
in_report_level_min IN NUMBER,
in_report_level_max IN NUMBER
IS
bin_period_length NUMBER(6,0);
BEGIN
SELECT MAX(period_length)
INTO bin_period_length
FROM bin_data
JOIN site_to_data_source_lane_v
ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
JOIN bin_types
ON bin_types.bin_type = bin_data.bin_type
WHERE site_to_data_source_lane_v.site_id = in_site_id
AND bin_data.start_date_time >= in_start_date_time - numtodsinterval(1, 'DAY')
AND bin_data.start_date_time < in_end_date_time + numtodsinterval(1, 'DAY')
AND bin_data.bin_type = 2
AND bin_data.period_length <= 60;
--Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
--report.
DELETE FROM edr_class_by_day_bin_data;
SELECT site_to_data_source_lane_v.site_id,
site_to_data_source_lane_v.site_lane_id,
site_to_data_source_lane_v.site_direction_id,
site_to_data_source_lane_v.site_direction_name,
bin_data_set.start_date_time,
bin_data_set.end_date_time,
bin_data_value.bin_id,
bin_data_value.bin_value
FROM bin_data
JOIN bin_data_set
ON bin_data.bin_serial = bin_data_set.bin_serial
JOIN bin_data_value
ON bin_data_set.bin_data_set_serial = bin_data_value.bin_data_set_serial
JOIN site_to_data_source_lane_v
ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
AND bin_data_set.lane = site_to_data_source_lane_v.data_source_lane_id
JOIN (
SELECT CAST(report_parameter_value AS NUMBER) lane_id
FROM report_parameters
WHERE report_parameters.report_parameter_id = in_report_parameter_id
AND report_parameters.report_parameter_group = 'LANE'
AND report_parameters.report_parameter_name = 'LANE'
) report_lanes
ON site_to_data_source_lane_v.site_lane_id = report_lanes.lane_id
JOIN (
SELECT CAST(report_parameter_value AS NUMBER) class_id
FROM report_parameters
WHERE report_parameters.report_parameter_id = in_report_parameter_id
AND report_parameters.report_parameter_group = 'CLASS'
AND report_parameters.report_parameter_name = 'CLASS'
) report_classes
ON bin_data_value.bin_id = report_classes.class_id
JOIN edr_rpt_tmp_inclusion_table
ON TRUNC(bin_data_set.start_date_time) = TRUNC(edr_rpt_tmp_inclusion_table.date_time)
WHERE site_to_data_source_lane_v.site_id = in_site_id
AND bin_data.start_date_time >= in_start_date_time - numtodsinterval(1, 'DAY')
AND bin_data.start_date_time < in_end_date_time + numtodsinterval(1, 'DAY')
AND bin_data_set.start_date_time >= in_start_date_time
AND bin_data_set.start_date_time < in_end_date_time
AND bin_data.bin_type = 2
AND bin_data.period_length = bin_period_length;
END class_by_day_get_bin_data;In the above code I'm using the hard coded value 2 for bin type
bin_data.bin_type = 2But I dont want any hard coded number or string in the query.
How could I replace it?
I defined conatant value like below inside my package body where the actual procedure comes.But I'm not sure whether I have to declare it inside package body or inside the procedure.
bin_type CONSTANT NUMBER := 2;But it does't look for this value. So I'm not able to get desired value for the report .
Thanks.
Edited by: user10641405 on May 29, 2009 1:38 PMDeclare the constant inside the procedure.
PROCEDURE class_by_day_get_bin_data(in_report_parameter_id IN NUMBER,
in_site_id IN NUMBER,
in_start_date_time IN TIMESTAMP,
in_end_date_time IN TIMESTAMP,
in_report_level_min IN NUMBER,
in_report_level_max IN NUMBER) IS
bin_period_length NUMBER(6, 0);
v_bin_type CONSTANT NUMBER := 2;
BEGIN
SELECT MAX(period_length)
INTO bin_period_length
FROM bin_data
JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
site_to_data_source_lane_v.data_source_id
JOIN bin_types ON bin_types.bin_type = bin_data.bin_type
WHERE site_to_data_source_lane_v.site_id = in_site_id
AND bin_data.start_date_time >=
in_start_date_time - numtodsinterval(1, 'DAY')
AND bin_data.start_date_time <
in_end_date_time + numtodsinterval(1, 'DAY')
AND bin_data.bin_type = v_bin_type
AND bin_data.period_length <= 60;
--Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
--report.
DELETE FROM edr_class_by_day_bin_data;
INSERT INTO edr_class_by_day_bin_data
(site_id,
site_lane_id,
site_direction_id,
site_direction_name,
bin_start_date_time,
bin_end_date_time,
bin_id,
bin_value)
SELECT site_to_data_source_lane_v.site_id,
site_to_data_source_lane_v.site_lane_id,
site_to_data_source_lane_v.site_direction_id,
site_to_data_source_lane_v.site_direction_name,
bin_data_set.start_date_time,
bin_data_set.end_date_time,
bin_data_value.bin_id,
bin_data_value.bin_value
FROM bin_data
JOIN bin_data_set ON bin_data.bin_serial = bin_data_set.bin_serial
JOIN bin_data_value ON bin_data_set.bin_data_set_serial =
bin_data_value.bin_data_set_serial
JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
site_to_data_source_lane_v.data_source_id
AND bin_data_set.lane =
site_to_data_source_lane_v.data_source_lane_id
JOIN (SELECT CAST(report_parameter_value AS NUMBER) lane_id
FROM report_parameters
WHERE report_parameters.report_parameter_id =
in_report_parameter_id
AND report_parameters.report_parameter_group = 'LANE'
AND report_parameters.report_parameter_name = 'LANE') report_lanes ON site_to_data_source_lane_v.site_lane_id =
report_lanes.lane_id
JOIN (SELECT CAST(report_parameter_value AS NUMBER) class_id
FROM report_parameters
WHERE report_parameters.report_parameter_id =
in_report_parameter_id
AND report_parameters.report_parameter_group = 'CLASS'
AND report_parameters.report_parameter_name = 'CLASS') report_classes ON bin_data_value.bin_id =
report_classes.class_id
JOIN edr_rpt_tmp_inclusion_table ON TRUNC(bin_data_set.start_date_time) =
TRUNC(edr_rpt_tmp_inclusion_table.date_time)
WHERE site_to_data_source_lane_v.site_id = in_site_id
AND bin_data.start_date_time >=
in_start_date_time - numtodsinterval(1, 'DAY')
AND bin_data.start_date_time <
in_end_date_time + numtodsinterval(1, 'DAY')
AND bin_data_set.start_date_time >= in_start_date_time
AND bin_data_set.start_date_time < in_end_date_time
AND bin_data.bin_type = v_bin_type
AND bin_data.period_length = bin_period_length;
END class_by_day_get_bin_data; -
Trigger how to get new and old value for nested table column?
Hi,
I have created a nested table based on the following details:
CREATE TYPE typ_item AS OBJECT --create object
(prodid NUMBER(5),
price NUMBER(7,2) )
CREATE TYPE typ_item_nst -- define nested table type
AS TABLE OF typ_item
CREATE TABLE pOrder ( -- create database table
ordid NUMBER(5),
supplier NUMBER(5),
requester NUMBER(4),
ordered DATE,
items typ_item_nst)
NESTED TABLE items STORE AS item_stor_tab
INSERT INTO pOrder
VALUES (800, 80, 8000, sysdate,
typ_item_nst (typ_item (88, 888)));
Now I would like to create a trigger on table pOrder for after insert or update or delete
and I would like to track the new and old value for the columns inside nested table.
Can anybody direct me how to do it?
I would like to know the sytax for it like:
declare
x number;
begin
x := :new.nestedtablecolumn;--how to get the new and old value from nested table columns
end;
Hope my question is clear.
Thanks,
LavanHi,
Try like this:
CREATE OR REPLACE TRIGGER PORDER_I
BEFORE INSERT
ON PORDER
REFERENCING OLD AS old NEW AS new
FOR EACH ROW
DECLARE
items_new typ_item_nst;
ordid_NEW NUMBER;
BEGIN
FOR i IN :new.items.FIRST .. :new.items.LAST LOOP -- For first to last element
DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').prodid: ' || :new.items(I).prodid );
DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').price: ' || :new.items(I).price );
END LOOP;
END;Regards,
Peter -
I want to read and assign value of ADF Table rows with Java Script
Hi,
I want to read and assign value of ADF Table rows with Java Script, but I cant true index of current row , so I assign wrong value to anathor column of ADF Table.
My Code;
ADF Table items
<af:column sortProperty="Adet" sortable="false"
headerText="#{bindings.RezervasyonWithParams1voHarcamaOdeme1.labels.Adet}"
binding="#{backing_ucret.column2}" id="column2">
<af:inputText value="#{row.Adet}"
required="#{bindings.RezervasyonWithParams1voHarcamaOdeme1.attrDefs.Adet.mandatory}"
columns="10"
binding="#{backing_ucret.inputText2}"
id="inputText2" onchange="getTutar('#{bindings.voHarcamaOdeme1Iterator.rangeStart + bindings.voHarcamaOdeme1Iterator.currentRowIndexInRange + 1}','#{bindings.voHarcamaOdeme1Iterator.estimatedRowCount}','#{row.index}')">
<f:convertNumber groupingUsed="false"
pattern="#{bindings.RezervasyonWithParams1voHarcamaOdeme1.formats.Adet}"/>
</af:inputText>
</af:column>
MY JAVA SCRIPT CODE
<f:verbatim>
<script language="javascript" type="text/javascript">
function getTutar(rowkey,totalrow,currentRow){
alert('rowkey--totalRow--currentRow-->'+rowkey+'--'+totalrow+'--'+currentRow);
if (currentRow==0) {
rowkey=totalrow-1;
}else{
var rw=totalrow-currentRow-1;
rowkey=rw;
alert(document.getElementById('form1:table1:'+rowkey+':inputText8').value);
alert(document.getElementById('form1:table1:'+currentRow+':inputText8').value);
var birim_ucret=document.getElementById('form1:table1:'+rowkey+':inputText8').value;
var adet=document.getElementById('form1:table1:'+rowkey+':inputText2').value;
document.getElementById('form1:table1:'+rowkey+':inputText3').value=birim_ucret*adet;
document.getElementById('form1:inputText6').value=0;
var t;
var toplam=0;
alert('before Sum');
for (var i=0;i!=totalrow-1;i++){
t = document.getElementById('form1:table1:'+i+':inputText3');
toplam+=t.value*1;
document.getElementById('form1:inputText6').value=toplam;
</script>
</f:verbatim>You can achieve the use case you describe with partial page rendering (PPR), a feature of the ADF Faces framework. Here are a few posts that achieve an interactive behavior using PPR. Off the top of my head I do not know of an exact example, but this should be a good starting point:
http://thepeninsulasedge.com/blog/2006/09/12/adf-faces-aftableselectmany/
http://thepeninsulasedge.com/blog/2006/08/31/adf-faces-working-with-aftableselectone-and-the-dialog-framework/
--RiC -
Ajax Autocomplete Tabular does not work using apex_item.text in SQL Query.
Hello,
Is it possible to use the search function which is used in, Dennis Kubicek example, ENAME topic Ajax Autocomplete Tabular
in a sql query using apex_items?
Query line :
, apex_item.text(17,xp.part_nr,null,null,'onfocus="f_register(this);" autocomplete="off"') PART
At first I followed the example by adding 'onfocus="f_register(this);" autocomplete="off" in the element attributes in the report field.
This didn't work... so tried to add the it in the attirbutes parameter of the apex_item.
But this still doesn't work. No errors are given, it does not respond.
Could somebody please help me?
Thx!
AstridWell, I'm trying to take this one step further, but I seem to be having some difficulty.
I'm trying to make a Filter screen to create a dynamic where clause filter screen.
This is a page I made with Popup LOVS, just to show you my goal (now trying to use autofilters)
http://apex.oracle.com/pls/otn/f?p=29989:5
I have a table on my system that tells you where the field is, and I'm using that to get the table (didn't want to change the javascript, so I pass in a static value).
This is the javascript code I used
<pre>
<script language="JavaScript" type="text/javascript">
function f_register(p_this,p_name)
var p_registered = $x('P5_ITEM_ID').value;
var p_this_name = $x(p_this).id;
//alert(p_this_name);
if (p_registered != p_this_name)
register(p_this_name, "COSTING_M", p_name, "blue", "red");
$x('P5_ITEM_ID').value = p_this_name;
</script>
</pre>
This is my query
<pre>
select column_name || apex_item.hidden(1,column_name) Col_name,
apex_item.SELECT_LIST_FROM_lov(2,'=','OPERATOR') OPERATOR,
apex_item.text (3,
NULL,
20,
200,
'onfocus="f_register(this,''' || column_name || ''');" autocomplete="off"',
'f3_' || '#ROWNUM#',
NULL
) value,column_id
from user_tab_cols
where table_name = 'COSTING_M'
ORDER BY ROWNUM
</pre>
and here is my on-demand process
<pre>
declare
TYPE CurTyp IS REF CURSOR;
v_row varchar2(4000);
rec CurTyp;
V_TABLENAME NKW.UTFIELD_M.TABLE_NAME%TYPE;
begin
BEGIN
SELECT TABLENAME INTO V_TABLENAME
FROM NKW.UTFIELD_M
WHERE FIELD_NAME = :TF_SL_COLUMN;
EXCEPTION WHEN NO_DATA_FOUND THEN RETURN; END;
:TF_SL_SEARCH := replace(:TF_SL_SEARCH, '&','&');
:TF_SL_SEARCH := replace(:TF_SL_SEARCH, '<','<');
:TF_SL_SEARCH := replace(:TF_SL_SEARCH, '>','>');
:TF_SL_SEARCH := replace(:TF_SL_SEARCH, '"','"');
owa_util.mime_header('text/xml', FALSE);
htp.p('Cache-Control: no-cache');
htp.p('Pragma: no-cache');
owa_util.http_header_close;
htp.prn('<rowset>');
open rec for
'select distinct ' || :TF_SL_COLUMN || ' ' ||
'from NKW.' || V_TABLE_NAME || ' ' ||
'where '||:TF_SL_COLUMN||' like :1||''%'' ' ||
'and rownum < 100 ' ||
'order by '||:TF_SL_COLUMN
using :TF_SL_SEARCH;
loop
fetch rec into v_row;
exit when rec%NOTFOUND;
htp.prn('<row>' || htf.escape_sc(v_row) || '</row>');
end loop;
htp.prn('</rowset>');
end;
</PRE>
I made some slight mods to make the table dynamic from my source table (this is to grab master files when they exist and not to when they don't).
I get my select list, but it's blank on all fields, any suggestions?
thanks,
Scott -
Insert data into sql database where the values are in an array
Hello Experts,
using vbscript i want to store data in MS SQL. i have prepared a script which works fine when i provide the static value but in actual i get the values in an array and now want to store values from there.
Below is not complete code but the block in question.
oRecordset_Working.Open "INSERT INTO tbl_work (release, version, state, Arch)" & _
"VALUES ('5.2', '11.25' , 'Active', 'XYZ')", _
oConnection, adOpenStatic, adLockOptimistic
i verified the database and can see the information is feeded.
What i really want to make work is:
for i=0 to UBound (arrValues)
oRecordset_Working.Open "INSERT INTO tbl_work (release, version, state, Arch)" & _
"VALUES ('arrValues(i)')", _
oConnection, adOpenStatic, adLockOptimistic
Next
logically it is incorrect as INSERT query comes inside the loop but then how can someone make it work?
can someone help me with this?
-KAKA-Here is the preferred method of inserting multiple values into multiple fields. It is very fast and very easy to set up.
Const adBSTR = 8
Const adInput = 1
Const CONNECTION_STRING = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\temp\test.mdb;Persist Security Info=False"
Const SQL_INSERT = "INSERT INTO Table1(ID, Name, Notes) VALUES(?, ?, ?)"
Set conn = CreateObject("ADODB.Connection")
conn.Open(CONNECTION_STRING)
Set cmd = CreateObject("ADODB.Command")
With cmd
.ActiveConnection = conn
.CommandText = SQL_INSERT
.Prepared = True
' create parameter object and assign to command object
.Parameters.Append .CreateParameter("ID", adBSTR, adInput)
.Parameters.Append .CreateParameter("Name", adBSTR, adInput)
.Parameters.Append .CreateParameter("Notes", adBSTR, adInput)
End With
' bind and insert values
For i = 2 To 10
cmd.Parameters("ID") = "ID" & i
cmd.Parameters("Name") = "Joe" & i
cmd.Parameters("Notes") = "My notes"
cmd.Execute
Next
conn.Close
¯\_(ツ)_/¯ -
Inserting a logo into the header and footer
Hey Team
I have a workbook with 5 worksheets. On sheet1 I have a button programed to open a new Word document; pull information from fields on 3 other sheets and creates a letter from that data. I have two company logos pasted into sheet5,
Pic1 and Pic2.
I want to copy Pic1 and paste it into the header and copy Pic2 and paste it into the footer of the newly created word document and have them both centered and on all pages.
As of now I can copy the Pics and paste them into the document body but have had no luck with the header or footer. Any help is greatly appreciated.
Thanks!First, when you create a Word doc you should always create it based on a predefined template. The template has all your corporate styles set etc...VBA code should only be used to insert text. I almost never use it manipulate anything that can't
be set in templates. The templates should already have the logos inserted.
Set rptDoc = Documents.Add("C:\templates\example.dotx")
rptDoc.SaveAs fileName:="C:\....................docx", _
FileFormat:=wdFormatDocumentDefault, AddToRecentFiles:=True
If you add a picture I recommend adding at it a predefined bookmark in the template. I do this when adding signatures. The bookmarks can be in the header.
Sub SetBkMarkPic(xDoc As Document, xBkName As String, xFile As String)
' Set bookmark in document. Add file to bookmark
If xDoc.Bookmarks.Exists(xBkName) Then
xDoc.Bookmarks(xBkName).Select
xDoc.Bookmarks(xBkName).Range.Text = ""
Selection.InlineShapes.AddPicture fileName:=xFile
End If
End Sub
Maybe you are looking for
-
How do I add MPEG clips, on my hard drive, to my iMovie library?
I have downloaded clips directly from my camcorder to my hard drive- MPEG format. I want to work with them in iMovie, but when I go to add them to my iMovie library they are greyed-out and not available. What am I doing wrong?
-
I can't open Adobe BrowserLab in Windows 7
It comes up, but the buttons on the right side only show their colors, and no words.
-
How do I restore permission access to entire iPhoto library
I am having trouble accessing photos within my iPhoto library. I keep just my iPhoto library on a separate partition of my MacBook Pro drive (but not my home folder). I can see thumbnails of the photos within iPhoto but when I try to access the large
-
I'm trying to sync my iPod touch with my iTunes library on my PC. I have previously done this successfully many times. The sync quits after about 9 songs are transferred. I imported several CDs and they show up with the red square inside the red c
-
How to make treetable transparent
hi, Does anyone have idea how to make the treetable transparent so that the background image can be shown? Pls provide sample code if possible,thanks!