I created a table and inserted 3 rows. Then I added a new column using alter. How can I add values to the column without using any null values?
mardi 4 août 2015
In SQL, How to add values after add a new column in the existing table?
Verification of Result in ESQL
Here's the situation: I run a query that gives me one or many rows as a result in an array.
Like:
SET db = PASSTHRU('SELECT GUID,CONTROLNBR FROM TRANSACTION WHERE GUID > ? AND CONTROLNBR > ?' values(maxGuid,maxControlNbr);
That works fine but I want to verify the following:
Any result that has duplicate CONTROLNBR's must have the same GUID
So if my result set has something like this:
CONTROLNBR | GUID
--------------------
5 | 123abc
5 | 123abc
this is entirely valid, however this I need to return an error on:
CONTROLNBR | GUID
--------------------
5 | 123abc
5 | abc123
I'm not sure the best way to test the result like this in ESQL/SQL.
can't make a trigger update only the relevant rows
I'm working on a school project and my trigger gives me a hard time.
Its' purpose is to update the Rating field of an updated Product, but it updates all rows in Products instead.
CREATE TRIGGER Update_Rating
ON dbo.Reviews
FOR Insert
as
Update dbo.Products
set Rating=(Select [avarage_rating]=avg(r.Rating)
From dbo.Reviews as r join inserted on r.ItemNumber = inserted.ItemNumber
where r.ItemNumber = Inserted.ItemNumber)
Your help is much appreciated
ROW_NUMBER query
I have a table:
Trip Stop Time
-----------------
1 A 1:10
1 B 1:16
1 B 1:20
1 B 1:25
1 C 1:31
1 B 1:40
2 A 2:10
2 B 2:17
2 C 2:20
2 B 2:25
I want to add one more column to my query output:
Trip Stop Time Sequence
-------------------------
1 A 1:10 1
1 B 1:16 2
1 B 1:20 2
1 B 1:25 2
1 C 1:31 3
1 B 1:40 4
2 A 2:10 1
2 B 2:17 2
2 C 2:20 3
2 B 2:25 4
The hard part is B, if B is next to each other I want it to be the same sequence, if not then count as a new row.
I know
row_number over (partition by trip order by time)
row_number over (partition by trip, stop order by time)
None of them will meet the condition I want. Is there a way to query this?
Sql Server Pivoting
Trying to convert the row value to column (PIVOT) of the given table.
S.No ID Column2 Column3
1 1 1 Firstname
2 1 2 MiddleName
3 1 14 ContactNumber
4 2 1 Firstname
5 2 14 ContactNumber
6 3 14 ContactNumber
7 3 2 MiddleName
I want like below for ID 1
Clumn2 1 2 14
Column3 FirstName MiddleName LastName
please help me to solve it. Thanks
how to change this sql statement so it returns one row per widget
I have the following sql query:
select O.name, O.asset_no, A.name as attr_name, AV.string_value, D.dict_value INTO OUTFILE '/tmp/networkchassis_1503_detailed.csv' FIELDS ENCLOSED BY '"' TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\r\n'
FROM Object as O
left join AttributeMap as AM on O.objtype_id = AM.objtype_id
left join Attribute as A on AM.attr_id = A.id
left join AttributeValue as AV on AV.attr_id = AM.attr_id and AV.object_id = O.id
left join Dictionary as D on D.dict_key = AV.uint_value and AM.chapter_id = D.chapter_id
left join Chapter as C on AM.chapter_id = C.id WHERE O.id IN ('5261', '5262', '5263', '5461', '5268', '5271', '22469', '5284', '14418', '5288', '5291', '5292', '5294', '5295', '20629', '20630', '5296', '5297', '5307', '5238', '22425', '22426', '5315', '5316', '22429', '22430', '5317', '22431', '22427', '22428', '5320', '5321', '5325', '5326', '13373', '5329', '14671', '14672', '22432', '22433', '8999', '648', '393', '394', '471', '395', '396', '1688', '1689', '268', '269', '5582', '5583', '5584', '5585', '5586', '5587') AND A.name in ("FQDN", "HW Type") ORDER BY O.name;
This returns two rows, per widet, one with FQDN, and the other for HW Type, like so:
+-----------+----------+-----------+--------------------------------+--------------------------------+
| name | asset_no | attr_name | string_value | dict_value |
+-----------+----------+-----------+--------------------------------+----------------------------------------+
| widget1 | 1026857 | HW Type | NULL | HP |
| widget1 | 1026857 | FQDN | widget1.domain.net | NULL |
I'd like to change the query so that I get one row, with both attributes specified. Something like this...
+-----------+----------+-------------------+----------------+--------------------------------+
| name | asset_no | fqdn | hw_type | string_value | dict_value |
+-----------+----------+-----------+--------------------------------+----------------------------------------+
| widget1 | 1026857 | widget2.domain.net| HP |
Syntax error (from clause) in query expression in statement
string sqlStatement = "SELECT Orders.[ID], Orders.[Checkintime], Orders.[RoomPrice], Orders.[OrderNo], Particulars.FirstName, Particulars.LastName FROM Orders, where Checkintime between '" + dateOnly + "' and '" + endDateOnly + "', Particulars;";
I tried using this statement to select information from my database but this statement has syntax errors from the FROM clause
Oracle forms where clause with a variable from bloc item
I'm trying to populate a block using a FROM clause in oracle forms like this:
select h.no_ordre, h.marge,h.date_modification, h.utilisateur_modification from hist_marge_0alb h, simul s, simtauxvar_0alb sv, affaire a where s.id_affaire = a.id_affaire and s.id_simul_element(+) = h.id_simul_element and sv.id_simul_element = s.id_simul_element and s.id_affaire = :SIMUL.id_affaire
But i got a FRM 40505 Error. I think the problem is in :SIMUL.id_affaire but I don't find a way to do it. Is there a way I can do it? Thanks.
concatenate query result in a string
I am getting a db result as 3 rows (Please see image link below).
The sql statement used is
select tevmkt.ev_mkt_id, tevmkt.name, tevmkt.ev_id, tevoc.ev_oc_id,
tevoc.desc, tevoc.fb_result, tevoc.lp_num, tevoc.lp_den,
tev.start_time
from tevmkt, tev,tevoc
where tevmkt.name = '|Match Result|' and tev.ev_id=tevmkt.ev_id and
tevoc.ev_mkt_id=tevmkt.ev_mkt_id and tev.start_time>=Today;
I will like to use php to concatenate each of the 3 rows into string or maybe use SQL statement.
So, the first 3 rows will display as ;
632274|Match Result||Draw||Aldershot Town||Arsenal FC|
And the next 3 rows
637799|Match Result||Draw||Southend United||Oxford United|
is it possible to store ResultSet from a query into an array and use the array as search parameters for an SQL query
i have two tables WorkSkillsPlanning(WSP) and TrainingAchieved(TA). WSP hold a list of planed training and targeted number of people to be trained e.g. ISOO:90001 10 people while TA holds the actual number of people trained as well as the actual course done. Since WSP and TA are dynamic in the sense that the data they hold is not static neither is known as training plans can change is it possible to run an intersect query on these table to find similarities i.e a course in WSP which has actually be done and recorded in TA. Store the results of the intersect query in an array e.g. MyArrayList{ISO,COMMUNICATION) these being values present in both table and use MyArrayList values to run count queries on TA to establish the number of people who would have done the course i.e ISO and COMMUNICATION and use the resultant to subtract from WSP (ISO,COMMUNICATION).
here is an example, first part
"Select QUALIFICATIONGROUP from APP.WSP intersect select COURSEBOOKED from APP.BOOKCOURSE"
which results in ISO and COMMUNICATION which i want to store in an ARRAY or variable.
second part
select count(COURSEBOOKED) from APP.BOOKCOURSE where COURSEBOOKED = Variable1
rs.getString(Count(COURSEBOOKED))
value returned == 5
re do the process again for COMMUNICATION and any other course in the array, of which after use the values returned from the count query to subtract to subtract WSP total minus TA total.
I hope this makes sense
Wondering about APIViews in Django
Hi I'm working on a Django site and am trying to figure out what the previously implemented code does. I'm new to Django so just figuring this stuff out on the fly. I'm looking at resources.py, and there's a snippet of code that looks like this:
class BaseQueryView(APIView):
def _parse_filter_values(self, data):
include = [] exclude = [] for d in data:and so on
I guess what I'm wondering is where is the APIView getting the "data" from? How can I find out how "data" is structured?
SQL - new column with the same cell value in every row for the same id without subquery
Sorry for bad title, I don't know how do describe better if you have a better one please tell me ;)
Please look at these small sql fiddle: http://ift.tt/1M93WZ6
I need the "Value" from a specific "Title" in a new column ("Age"). But I need the "Value" in any row for the same "SN_Main". The first query was my first try. It is fast and ok but I get the "Value" only for the row with the same "Title".
The second query is wat I want but the subquery is to slow, so I wanna solve this without subquery. The productive tables are bigger and I need this like 10 times and with subquery it become incredible slow.
So is there any way to get this output with other sql statements???
I hope you understand me, I'm so sorry about bad explanation :)
Regards Martin
Reload table after searching
I'm trying to edit a column of a table after I search it using a drop down list; however, when I click the "Edit" button nothing shows up. Please advise and thank you!
More info: I have a Home page where the drop down list is located and as I click search it references the Results.aspx page where the table is shown and, as stated above, when I click edit nothings shows up.
Home.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace Inventory
{
public partial class Home : System.Web.UI.Page
{
SqlConnection cn = new SqlConnection("Data Source=10.10.101.188;Initial Catalog=ActioNetITInventory;User ID=rails.sa;Password=ActioNet1234");
protected void Page_Load(object sender, EventArgs e)
{
//methods
Populate1();
}//end page_load
//puts data on the first dropdown list
public void Populate1()
{
SqlCommand cmd = new SqlCommand("SELECT * FROM [Inventory]", new SqlConnection(ConfigurationManager.AppSettings["ConnString"]));
cmd.Connection.Open();
SqlDataReader ddlValues;
ddlValues = cmd.ExecuteReader();
DropDownList1.DataSource = ddlValues;
DropDownList1.DataValueField = "Assigned";
DropDownList1.DataTextField = "Assigned";
DropDownList1.DataBind();
//starts the dropdown list with empty so you can search with serial or the drop down
DropDownList1.Items.Insert(0, new ListItem(String.Empty, "--Select--"));
DropDownList1.SelectedIndex = 0;
cmd.Connection.Close();
cmd.Connection.Dispose();
}//end populate one
}//end class
}//end namespace Inventory
Results.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace Inventory
{
public partial class Results : System.Web.UI.Page
{
SqlConnection conn = new SqlConnection("Data Source=10.10.101.188;Initial Catalog=ActioNetITInventory;User ID=rails.sa;Password=ActioNet1234");
protected void Page_Load(object sender, EventArgs e)
{
}
}//end class
}//end name space
Results.html:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Results.aspx.cs" Inherits="Inventory.Results" %>
<!DOCTYPE html>
<html xmlns="http://ift.tt/lH0Osb">
<head id="Head1" runat="server">
<title>Results</title>
<link href="StyleSheet1.css" rel="stylesheet" />
<link href="Background.css" rel="stylesheet" type="text/css" />
<link href="Default.css" rel="stylesheet" />
<link href="Component.css" rel="stylesheet" />
<link rel="shortcut icon" href="~/logo.ico" type="image/x-icon" />
<style type="text/css">
.auto-style1 {
height: 80px;
width: 335px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="margin-left: 400px">
<br />
<br />
<br />
<br />
<br />
<br />
<!--logo-->
<img alt="" class="auto-style1" src="logo.jpg" />
<br />
<br />
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"
CellPadding="4"
DataKeyNames="Serial"
DataSourceID="SqlDataSource1"
ForeColor="#333333"
ShowFooter="True"
Width="1393px" >
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<Columns>
<asp:CommandField ShowEditButton="True" ButtonType="Button" />
<asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
<asp:BoundField DataField="Make" HeaderText="Make" SortExpression="Make" />
<asp:BoundField DataField="Model" HeaderText="Model" SortExpression="Model" />
<asp:BoundField DataField="Serial" HeaderText="Serial" ReadOnly="True" SortExpression="Serial" />
<asp:TemplateField HeaderText="Assigned" SortExpression="Assigned">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Assigned") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("Assigned") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Location" SortExpression="Location">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Location") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Location") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Notes" SortExpression="Notes">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Notes") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Notes") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#E9E7E2" />
<SortedAscendingHeaderStyle BackColor="#506C8C" />
<SortedDescendingCellStyle BackColor="#FFFDF8" />
<SortedDescendingHeaderStyle BackColor="#6F8DAE" />
</asp:GridView>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ActioNetITInventoryConnectionString %>"
SelectCommand="SELECT * FROM [Inventory] WHERE ([Assigned] = @Assigned)"
DeleteCommand="DELETE FROM [Inventory] WHERE [Serial] = @Serial"
InsertCommand="INSERT INTO [Inventory] ([Type], [Make], [Model], [Serial], [Assigned], [Location], [Notes]) VALUES (@Type, @Make, @Model, @Serial, @Assigned, @Location, @Notes)"
UpdateCommand="UPDATE [Inventory] SET [Type] = @Type, [Make] = @Make, [Model] = @Model, [Assigned] = @Assigned, [Location] = @Location, [Notes] = @Notes WHERE [Serial] = @Serial">
<DeleteParameters>
<asp:Parameter Name="Serial" Type="String" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Type" Type="String" />
<asp:Parameter Name="Make" Type="String" />
<asp:Parameter Name="Model" Type="String" />
<asp:Parameter Name="Serial" Type="String" />
<asp:Parameter Name="Assigned" Type="String" />
<asp:Parameter Name="Location" Type="String" />
<asp:Parameter Name="Notes" Type="String" />
</InsertParameters>
<SelectParameters>
<asp:FormParameter FormField="DropDownList1" Name="Assigned" Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="Type" Type="String" />
<asp:Parameter Name="Make" Type="String" />
<asp:Parameter Name="Model" Type="String" />
<asp:Parameter Name="Assigned" Type="String" />
<asp:Parameter Name="Location" Type="String" />
<asp:Parameter Name="Notes" Type="String" />
<asp:Parameter Name="Serial" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
<br />
<asp:Button ID="Button1" runat="server" PostBackUrl="~/Home.aspx" Text="Back" Width="88px" />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>
</form>
</body>
</html>
Running out of disk space on MySQL partition azure
I created replication in Microsoft Azure Virtual Machine .
I'm using MySQL and working with sql workbench (windows).
yesterday I discovered that my 250 GB storage are full and replication stopped.
this log wrote,
Timestamp, Thread, Type, Details
2015-07-29 23:26:44, 1672, Warning, Disk is full writing '.\database123-relay-bin.000164' (Errcode: 28 - No space left on device). Waiting for someone to free space...
and I created another 250 GB external storage.
I have 2 Q :
-
how can I create queries and use data within two difference storage ?
-
is it the right thing to do? to create another storage or there is a way to create flexible storage
?
that i found is this : http://ift.tt/1HnO64W
but it not help , need help and Guidance
SQL - Knocking off Accordingly
I have an issue in SQL where all transaction just come into one giant messy tables.
Example:
1 | Invoice | $300
2 | Invoice | $250
3 | Payment | $100
4 | Invoice | $200
5 | Payment | $300
So i will have 3 invoices and 2 paymentsbut
the Payment at line 3 can only be knocking off the Invoice on line 1 and Payment on line 5 is for the Invoice in line 2.
I want to Net Off the Payment and Find rather it is an Overpayment or Underpayment or it is knocking off entire invoice.
How can i do this?
How to PIVOT and filter with two parameter?
I have such SQ
SELECT * FROM (
SELECT dt.route_id,dc.card_type_id,dt.amount, dt.currency_id
FROM ddrc_trans dt, ddrc_card dc, ddrc_card_type drc
WHERE ( dt.card_id = dc.id AND dt.route_id IN ( 1,2) )
)
Which returns such result
1 1 2 50 3
2 1 2 50 3
3 1 2 50 3
4 2 1 50 1
5 2 1 50 1
OK that looks nice!
I write pivot, in order to convert rows to columns.
SELECT * FROM (
SELECT dt.route_id,dc.card_type_id,dt.amount, dt.currency_id
FROM ddrc_trans dt, ddrc_card dc, ddrc_card_type drc
WHERE ( dt.card_id = dc.id AND dt.route_id IN ( 1,2) )
)
pivot
(
SUM(amount) as AMOUNT_DATA
FOR card_type_id IN (1,2)
)
It looks perfect!
1 2 1 900 NULL
2 2 3 NULL 1050
3 1 2 1050 NULL
4 1 3 NULL 900
5 1 1 1050 NULL
6 2 2 1050 NULL
But 1. what should I do in order to filter with curency id? for instance I need to show only currency id. 2. How can I group with currency id? I do not want to be duplicated CURRENTY_ID.
I have do my solution like this, is there another way without concat?
SELECT *
FROM (
SELECT dt.route_id, dt.amount, concat(concat( dt.currency_id , ' '), dc.card_type_id) as conval
FROM ddrc_trans dt,
ddrc_card dc,
ddrc_card_type drc
WHERE ( dt.card_id = dc.id
AND dt.route_id IN ( 1,2)
AND drc.id IN ( 1,2,3 )
)
) s
PIVOT
(
SUM(amount) AM
FOR conval IN ('5 1', '5 2', '5 3')
) pivot1
Postgres - get count of a chacter in a column?
In Postgres/SQL, how can I get the count of a character in a column?
For example, I want to run a query which will return the number of times "X" appears in a column that has the value "XXX" - and it should return 3.
3-level Hierarchical SQL Query
I'm very well aware of basic SQL queries, however I've never worked with a query that deals with hierarchical data.
I'm using the Telerik TreeView control to display data related to a school board with the following structure:
--School "ABC"
----Class "Grade 1"
----Class "Grade 2"
------Student #1
------Student #2
--School "DEF"
----Class "Grade 1"
------Student #3
----Class "Grade 3"
The TreeView is in a tri-state checkbox mode, so each element can be checked off. So if a single child element is checked then the parent element will be checked as well, and when checking a parent element all the child elements will be checked.
After checking off some schools, classes, and students, the following screen displays information about the students in a graph which currently uses the school IDs (if multiple are checked) to select all students of those schools.
Here's where it gets tricky. Using the above structure as an example, I select the class "Grade 1" from the school "ABC" and class "Grade 3" from the school "DEF" which in turn will select students # 1 & #2.
As mentioned before, my current SQL query is based solely on the school ID and I know that I can't simply add two other conditions in the where clause that look like this:
AND ClassID IN ('Grade 1', 'Grade 3') --Note there is no primary key for classes, and I can't change that in my position..
AND StudentID IN (1,2)
as this will also select student #3 from the other class title "Grade 1"
So my question is, how to I combine the School ID(s), Class name(s), and student ID(s) into one condition that will solve this issue.
Any help would be greatly appreciated as I'm really stuck on this question with a very strict deadline, thanks!!
Reverse Concat - Split function
I have a table and it has a value column that lists data as: Row 1: '00','01','02','03' Row 2: '03','02','09','08'
I have a couple of split functions
FUNCTION [dbo].[udf_Split](@String varchar(MAX), @Delimiter char(1))
returns @temptable TABLE (Item varchar(MAX))
as
begin
declare @idx int
declare @slice varchar(8000)
select @idx = 1
if len(@String)<1 or @String is null return
while @idx<>0
begin
set @idx = charindex(@Delimiter,@String)
if @idx!=0
set @slice = left(@String,@idx - 1)
else
set @slice = @String
if(len(@slice)>0)
insert into @temptable(Item) values(@slice)
set @String = right(@String,len(@String) - @idx)
if len(@String) = 0 break
end return end;
I'm trying to create a view of the table, with that column and then I'd like my view results to be a list of rows that have each value broken to its own row (and distinct) So would look like: (the tics can stay or go, don't care about them right now) Row 1: 00 Row 2: 01 Row 3: 02 Row 4: 03
My view is pretty much a:
SELECT DISTINCT VALUE FROM TABLE
cross apply dbo.split(Value, ',') as Item
But it's not working. Can someone lend me some direction on how I should work this?
Inserting data to Formatted Excel after First row (Column header)
I am trying to add the grid view rows data to formatted excel, my formatted excel contains 6 column named col1, col2, col3, total1, total2 and total3, I made some calculation on total1,total2 and total3. My grid view contains 8 rows but I am trying to add first three fetched data to Excel, data are inserting perfectly except the data are inserted after some range i.e., non used area, but the calculation are available from row 2,
Please find my code below.
protected void Export_Click(object sender, EventArgs e)
{
int gridi,j,value1, value2, value3;
int rowcount = GridView1.Rows.Count;
int Colcount = 3;
String[] cellText;
string path = @"D:\ExcelTemplate\template.xlsx";
constr = ConfigurationManager.ConnectionStrings["Excel07ConString"].ConnectionString;
constr = string.Format(constr, path);
using (OleDbConnection excel_con = new OleDbConnection(constr))
{
excel_con.Open();
string sheet1 = excel_con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null).Rows[0]["TABLE_NAME"].ToString();
DataTable dtExcelData = new DataTable();
dtExcelData = excel_con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
String[] excelSheets = new String[dtExcelData.Rows.Count];
int i = 0;
foreach (DataRow row in dtExcelData.Rows)
{
excelSheets[i] = row["TABLE_NAME"].ToString();
i++;
}
sheetinfo = excelSheets[2];
try
{
foreach (GridViewRow row in GridView1.Rows)
{
int count = 2;
value1 = Convert.ToInt32(row.Cells[0].Text.Trim());
value2 = Convert.ToInt32(row.Cells[1].Text.Trim());
value3 = Convert.ToInt32(row.Cells[2].Text.Trim());
//string excelquery = "Insert into ["+sheetinfo+"A2:C20000] (Column1,Column2,Column3) values(" + value1 + "," + value2 + "," + value3 + ")";
string excelquery = "Insert into [sheet1$](A" + count + ",B" + count + ",C" + count + ") values(" + value1 + "," + value2 + "," + value3 + ")";
using (OleDbDataAdapter oda = new OleDbDataAdapter(excelquery, excel_con))
{
oda.Fill(dtExcelData);
}
excel_con.Close();
Label1.Visible = true;
Label1.Text = "Insert to the Excel [[[Success]]]";
count += 1;
}
}
catch (Exception ex)
{
//Label1.Visible = true;
//Label1.Text = ex.ToString();
}
}
kindly suggest the solution for my issue.