Friday, March 30, 2012
How Can I retrieve data from a self joined table
i have one table with the format
PKEmployeeID PrimaryKey
FKDeptID
Salary
EmployeeName
FKEmployeeID
here I have to retrieve the max salary by dept wise
thats ok by writing
Select max(salary),FKDeptID from Employee_Sarada group by FKDeptID
How can i retrieve the employeename for the max salary
Thanks and Regards
Sarada VIt may be possible in same FKDeptID two or more employee have same
salary which is max in that FKDeptID.
Select max(salary), employeename, FKDeptID from employee_sarda group by
employeename,FKDeptID.
or
if you want only one name then
Select max(salary), max(employeename), FKDeptID from employee_sarda
group by FKDeptID.
Please post ddl with data to get better idea.
Regards
Amish
*** Sent via Developersdex http://www.developersdex.com ***|||Hi
Can you provide us with your table's stucture?
--Written by Itzik Ben-Gan
CREATE TABLE Employees
(
empid int NOT NULL,
mgrid int NULL,
empname varchar(25) NOT NULL,
salary money NOT NULL,
CONSTRAINT PK_Employees_empid PRIMARY KEY(empid),
CONSTRAINT FK_Employees_mgrid_empid
FOREIGN KEY(mgrid)
REFERENCES Employees(empid)
)
CREATE INDEX idx_nci_mgrid ON Employees(mgrid)
INSERT INTO Employees VALUES(1 , NULL, 'Nancy' , $10000.00)
INSERT INTO Employees VALUES(2 , 1 , 'Andrew' , $5000.00)
INSERT INTO Employees VALUES(3 , 1 , 'Janet' , $5000.00)
INSERT INTO Employees VALUES(4 , 1 , 'Margaret', $5000.00)
INSERT INTO Employees VALUES(5 , 2 , 'Steven' , $2500.00)
INSERT INTO Employees VALUES(6 , 2 , 'Michael' , $2500.00)
INSERT INTO Employees VALUES(7 , 3 , 'Robert' , $2500.00)
INSERT INTO Employees VALUES(8 , 3 , 'Laura' , $2500.00)
INSERT INTO Employees VALUES(9 , 3 , 'Ann' , $2500.00)
INSERT INTO Employees VALUES(10, 4 , 'Ina' , $2500.00)
INSERT INTO Employees VALUES(11, 7 , 'David' , $2000.00)
INSERT INTO Employees VALUES(12, 7 , 'Ron' , $2000.00)
INSERT INTO Employees VALUES(13, 7 , 'Dan' , $2000.00)
INSERT INTO Employees VALUES(14, 11 , 'James' , $1500.00)
GO
> Select max(salary),FKDeptID from Employee_Sarada group by FKDeptID
> How can i retrieve the employeename for the max salary
CREATE FUNCTION dbo.ufn_GetSubtreeSalary
(
@.mgrid AS int
)
RETURNS int
AS
BEGIN
RETURN (SELECT Salary
FROM Employees WHERE empid = @.mgrid) +
CASE
WHEN EXISTS(SELECT * FROM Employees WHERE mgrid = @.mgrid) THEN
(SELECT SUM(dbo.ufn_GetSubtreeSalary(empid))
FROM Employees
WHERE mgrid = @.mgrid)
ELSE 0
END
END
GO
SELECT dbo.ufn_GetSubtreeSalary(3)
GO
If it doesnot help , pls show us an expected result
"pandu" <saradabhanuv@.gmail.com> wrote in message
news:1135835404.968676.316380@.g14g2000cwa.googlegroups.com...
> hi all
> i have one table with the format
> PKEmployeeID PrimaryKey
> FKDeptID
> Salary
> EmployeeName
> FKEmployeeID
> here I have to retrieve the max salary by dept wise
> thats ok by writing
> Select max(salary),FKDeptID from Employee_Sarada group by FKDeptID
> How can i retrieve the employeename for the max salary
> Thanks and Regards
> Sarada V
>
Wednesday, March 28, 2012
how can i regenerate Database from my Backup file ? ?
hello All !!
i have taken mybackup(back file ) of database and i stored in folder , now i want to know
1)if i format my Hard Disk . and reinstall Sql server 2000 ?
2) if i delete that Database ?
how can i REGENERATE my database ?? again
thnk u all
In case you just have the backup somewhere safe / available after you have done / faced with 1) and/or 2), you can just restore the database from the .bak file.
SQl Server 2000 Backup And Restore
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/sqlbackuprest.mspx
Wednesday, March 21, 2012
How can i merge 2 rows become 1?
i need your help...can i make report like the format below?
No |StudentName | Event | odd |
------------------
1. | Johnc | | |
2. | Mark | | |
------------------
3. | Steven | | |
4. | Thomas | | |
------------------
I try to put 2 same fields in detail section, but it duplicates the same value..
pliz, help me...thanks.... :)How does the data table look like to begin with?|||u cannot include a line coz u cannot right suppress formula on it.
Include a tectobject in detail section with -- in it
then write this formula
whileprintingrecords;
recordnumber mod 2<>0
on suppress in format tab.
thats it.
Monday, March 19, 2012
how can I let DATEFORMAT by default
I need to let datetime format in YMD by default
How can I get it?
Thans
The language setting determines the default value for the DATEFORMAT. To
display the default setting for each language issue the following command:
sp_helplanguage
----
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"parodrig" <parodrig@.discussions.microsoft.com> wrote in message
news:A9A1C085-FB65-4380-A6FC-DCDB7B1529F8@.microsoft.com...
> SET DATEFORMAT change format of datetime in query
> I need to let datetime format in YMD by default
> How can I get it?
> Thans
Monday, March 12, 2012
how can I let DATEFORMAT by default
I need to let datetime format in YMD by default
How can I get it?
ThansThe language setting determines the default value for the DATEFORMAT. To
display the default setting for each language issue the following command:
sp_helplanguage
----
----
--
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"parodrig" <parodrig@.discussions.microsoft.com> wrote in message
news:A9A1C085-FB65-4380-A6FC-DCDB7B1529F8@.microsoft.com...
> SET DATEFORMAT change format of datetime in query
> I need to let datetime format in YMD by default
> How can I get it?
> Thans
Friday, March 9, 2012
How can i insert a curreny formated column
Wednesday, March 7, 2012
how can i import .csv file into database using SQL statement.
i can import data by change .CSV to .XLS and import .XLS file, but i hvae copy data from .CSv to .XLS it is not good ,so can you show me how to import .CSV file.
i am using SQL2005
thanks for your help
You could use OPENROWSET function with BULK option:
SELECT a.* FROM OPENROWSET( BULK 'c:\test\values.txt',
FORMATFILE = 'c:\test\values.fmt') AS a;
About OPENROWSET: http://msdn2.microsoft.com/en-us/library/ms190312.aspx
About format files: http://msdn2.microsoft.com/en-us/library/ms175915.aspx
Sunday, February 19, 2012
How can I format the Date in the SQL Table using a SQL query
Hi
I have a SQL table that contains date in this format :-
2006-07-02 16:20:01.000
2006-07-02 16:21:00.000
2006-07-02 16:21:01.000
2006-07-02 16:22:00.000
2006-07-02 16:22:02.000
2006-07-02 16:23:00.000
The date above contains seconds that I dont want, how can I remove those seconds so that the output looks like :-
2006-07-02 16:20:00.000
2006-07-02 16:21:00.000
2006-07-02 16:21:00.000
2006-07-02 16:22:00.000
2006-07-02 16:22:00.000
2006-07-02 16:23:00.000
Your help will be highly appreciated.
Hi,
You can do as..
update tablename set datecolumn = select dateadd(s, -datepart(s,datecolumn), datecolumn)
|||
That will change the data. If you only want to change the display, then try this ;
select replace(convert(varchar(20), columnName, 102), '.', '-') + ' ' + left(convert(varchar(20), columnName, 108), 5) + ':00.000'
from tableName
In case you do not want to update the table you just need to change it in display you can do as..
select dateadd(s, -datepart(s,datecolumn), datecolumn)
from tablename
|||Hi, thanks for the reply
Here is what i have tried
UPDATE [dbo].[Date_Test] SET Date = SELECT DATEADD(s, -DATEPART(s,Date), Date)
and Im getting the following error, i dont understand whats causing it.
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'SELECT'.
Please help.
|||Rod Colledge wrote:
That will change the data. If you only want to change the display, then try this ;
select replace(convert(varchar(20), columnName, 102), '.', '-') + ' ' + left(convert(varchar(20), columnName, 108), 5) + ':00.000'
from tableName
Thanks, but I want to change the data, not to display it.
|||Hi,
You need to remove Select Key word..
UPDATE [dbo].[Date_Test] SET Date = DATEADD(s, -DATEPART(s,Date), Date)
Shallu wrote:
Hi,
You need to remove Select Key word..
UPDATE [dbo].[Date_Test] SET Date = DATEADD(s, -DATEPART(s,Date), Date)
Thanks Shallu, it work perfect
How can I format a datetime field in a stored procedure
CONVERT(varchar, youddatecolumn, 101).
Check out the CAST and CONVERT functions in BOL for more formats.
|||Use T-SQL Convert function and instead of returning date object return string representation of that date.
Or, return date object from Stored Procedure and convert it in C# code to appropriate format.
|||ived been properly arranging the quotes and single quotes but still it has error...it changes the error but has error still...
'2006' 付近に不適切な構文があります。 (There is an improper syntax in the vicinity ..'20 06'... )
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Data.SqlClient.SqlException: '2006' 付近に不適切な構文があります。
Source Error:
Line 113: sqlcom.Parameters.AddWithValue("@.ninka_date_kyou", textbox_approval_date.Text)Line 114:Line 115: sqlcom.ExecuteNonQuery()Line 116: MyConn.Close()Line 117: sqlcom.Dispose()
MyConn.Open()
sqlcom.CommandType = CommandType.Text
sqlcom.CommandText = "update TE_zangyou Set ninka_nen_from = @.ninka_nen_from ,ninka_gatsu_from = @.ninka_gatsu_from, ninka_hi_from = @.ninka_hi_from ,ninka_nen_to = @.ninka_nen_to, ninka_gatsu_to = @.ninka_gatsu_to, ninka_hi_to = @.ninka_hi_to, ninka_ji_from = @.ninka_ji_from,ninka_ji_to = @.ninka_ji_to,ninka_bun_from = @.ninka_bun_from,ninka_bun_to = @.ninka_bun_to,ninka_day_name_from = @.ninka_day_name_from,ninka_day_name_to= @.ninka_day_name_to,ninka_date_kyou= @.ninka_date_kyou where syain_No = " + Request.QueryString("syain_No")+ " and date_kyou ='" + Request.QueryString("date_kyou") + "' and time_kyou ='" + Request.QueryString("time_kyou") + "'"
but the format in my database is like this:"2006/12/12" and its just character string...
so it will just compare whether they have thesame date_kyou...
but it produces errors like that!
can u help me determine my mistake? thank you..:-)
Two things here:
1.Please use all parameters for your WHERE clause variables;
2.What data types are these columns in your database table?
Datetime column may be hard to use at the beginning, but it is worth it. Try it.
|||Hi,
is your datafield varchar or datetime?
if it's a varchar field containing the date in a string format 'yyyy/mm/dd', it may be a syntax error.
You can try debugging your appln and providing us with the value of the data in your code to check if theres a syntax error with "textbox_approval_date.Text".
if it's a datetime field, you can try converting the value in "textbox_approval_date.Text" to a datetime object first before passing it into your statement using the CONVERT function.
Hope this helps.
|||
its only character string... and its working when i just put requerystring(syain_No) but when i included the date_kyou and time_kyou,.,,, it produces that kind of error...
what do u think is the problem here?
|||
Dim MyConn As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("StrConn").ConnectionString)
Dim sqlcom As SqlClient.SqlCommand = MyConn.CreateCommand()
MyConn.Open()
sqlcom.CommandType = CommandType.Text
sqlcom.CommandText = "update TE_zangyou Set ninka_nen_from = @.ninka_nen_from ,ninka_gatsu_from = @.ninka_gatsu_from, ninka_hi_from = @.ninka_hi_from ,ninka_nen_to = @.ninka_nen_to, ninka_gatsu_to = @.ninka_gatsu_to, ninka_hi_to = @.ninka_hi_to, ninka_ji_from = @.ninka_ji_from,ninka_ji_to = @.ninka_ji_to,ninka_bun_from = @.ninka_bun_from,ninka_bun_to = @.ninka_bun_to,ninka_day_name_from = @.ninka_day_name_from,ninka_day_name_to= @.ninka_day_name_to,ninka_date_kyou= @.ninka_date_kyou where syain_No = " + Request.QueryString("syain_No")+ " and date_kyou ='" + Request.QueryString("date_kyou") + "' and time_kyou ='" + Request.QueryString("time_kyou") + "'"
sqlcom.Parameters.AddWithValue("@.ninka_nen_from", TextBox1.Text)
sqlcom.Parameters.AddWithValue("@.ninka_gatsu_from", TextBox2.Text)
sqlcom.Parameters.AddWithValue("@.ninka_hi_from", TextBox3.Text)
sqlcom.Parameters.AddWithValue("@.ninka_day_name_from", TextBox5.Text)
sqlcom.Parameters.AddWithValue("@.ninka_ji_from", textbox_from_hr.Text)
sqlcom.Parameters.AddWithValue("@.ninka_bun_from", textbox_from_min.Text)
sqlcom.Parameters.AddWithValue("@.ninka_nen_to", TextBox6.Text)
sqlcom.Parameters.AddWithValue("@.ninka_gatsu_to", TextBox7.Text)
sqlcom.Parameters.AddWithValue("@.ninka_hi_to", TextBox8.Text)
sqlcom.Parameters.AddWithValue("@.ninka_day_name_to", TextBox9.Text)
sqlcom.Parameters.AddWithValue("@.ninka_ji_to", textbox_to_hr.Text)
sqlcom.Parameters.AddWithValue("@.ninka_bun_to", textbox_to_min.Text)
Label28.Visible = True
textbox_approval_date.Visible = True
textbox_approval_date.Text = Date.Today
statusbox_approve_mesg.Visible = True
sqlcom.Parameters.AddWithValue("@.ninka_date_kyou", textbox_approval_date.Text)
sqlcom.ExecuteNonQuery()
MyConn.Close()
sqlcom.Dispose()
MyConn.Dispose()
MsgBox(" Application Dates was Approved")
TextBox1.Enabled = False
TextBox2.Enabled = False
TextBox3.Enabled = False
TextBox6.Enabled = False
TextBox5.Enabled = False
TextBox7.Enabled = False
TextBox8.Enabled = False
TextBox9.Enabled = False
textbox_from_hr.Enabled = False
textbox_from_min.Enabled = False
textbox_to_hr.Enabled = False
textbox_to_min.Enabled = False
Reason.Enabled = False
compensantory.Enabled = False
Edit1.Visible = False
Button_save.Visible = False
Button_approve.Visible = False
Button_reject.Visible = False
Button_send.Visible = True
&&&& my code... what u think? there is an error in thebold words
|||Dim MyConn As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("StrConn").ConnectionString)Dim sqlcom As SqlClient.SqlCommand = MyConn.CreateCommand()
MyConn.Open()
sqlcom.CommandType = CommandType.Text
sqlcom.CommandText = "update TE_zangyou Set ninka_nen_from = @.ninka_nen_from ,ninka_gatsu_from = @.ninka_gatsu_from, ninka_hi_from = @.ninka_hi_from ,ninka_nen_to = @.ninka_nen_to, ninka_gatsu_to = @.ninka_gatsu_to, ninka_hi_to = @.ninka_hi_to, ninka_ji_from = @.ninka_ji_from,ninka_ji_to = @.ninka_ji_to,ninka_bun_from = @.ninka_bun_from,ninka_bun_to = @.ninka_bun_to,ninka_day_name_from = @.ninka_day_name_from,ninka_day_name_to= @.ninka_day_name_to,ninka_date_kyou= @.ninka_date_kyou where syain_No = " + Request.QueryString("syain_No")+ " and date_kyou ='" + Request.QueryString("date_kyou") + "' and time_kyou ='" + Request.QueryString("time_kyou") + "'"
sqlcom.Parameters.AddWithValue("@.ninka_nen_from", TextBox1.Text)
sqlcom.Parameters.AddWithValue("@.ninka_gatsu_from", TextBox2.Text)
sqlcom.Parameters.AddWithValue("@.ninka_hi_from", TextBox3.Text)
sqlcom.Parameters.AddWithValue("@.ninka_day_name_from", TextBox5.Text)
sqlcom.Parameters.AddWithValue("@.ninka_ji_from", textbox_from_hr.Text)
sqlcom.Parameters.AddWithValue("@.ninka_bun_from", textbox_from_min.Text)
sqlcom.Parameters.AddWithValue("@.ninka_nen_to", TextBox6.Text)
sqlcom.Parameters.AddWithValue("@.ninka_gatsu_to", TextBox7.Text)
sqlcom.Parameters.AddWithValue("@.ninka_hi_to", TextBox8.Text)
sqlcom.Parameters.AddWithValue("@.ninka_day_name_to", TextBox9.Text)
sqlcom.Parameters.AddWithValue("@.ninka_ji_to", textbox_to_hr.Text)
sqlcom.Parameters.AddWithValue("@.ninka_bun_to", textbox_to_min.Text)
Label28.Visible = True
textbox_approval_date.Visible = True
textbox_approval_date.Text = Date.Today
statusbox_approve_mesg.Visible = True
sqlcom.Parameters.AddWithValue("@.ninka_date_kyou", textbox_approval_date.Text)
sqlcom.ExecuteNonQuery()
MyConn.Close()
sqlcom.Dispose()
MyConn.Dispose()
MsgBox(" Application Dates was Approved")
TextBox1.Enabled = False
TextBox2.Enabled = False
TextBox3.Enabled = False
TextBox6.Enabled = False
TextBox5.Enabled = False
TextBox7.Enabled = False
TextBox8.Enabled = False
TextBox9.Enabled = False
textbox_from_hr.Enabled = False
textbox_from_min.Enabled = False
textbox_to_hr.Enabled = False
textbox_to_min.Enabled = False
Reason.Enabled = False
compensantory.Enabled = False
Edit1.Visible = False
Button_save.Visible = False
Button_approve.Visible = False
Button_reject.Visible = False
Button_send.Visible = True
&&&& my code... what u think? there is an error in thebold words
and date_kyou and time_kyou are character string only...
|||
Change to this and try:
...
where syain_No =@.syain_No AND date_kyou=@.date_kyou AND time_kyou=@.time_kyou
.....
sqlcom.Parameters.AddWithValue("@.syain_No", Request.QueryString("syain_No"))
sqlcom.Parameters.AddWithValue("@.date_kyou", Request.QueryString("date_kyou"))
sqlcom.Parameters.AddWithValue("@.time_kyou,Request.QueryString("time_kyou"))
|||パラメータ化クエリ '(@.syain_No nvarchar(4),@.date_kyou nvarchar(12),@.time_kyou nvarch' にはパラメータ @.time_kyou が必要ですが、指定されていません。 (It is not specified though parameter @.time_kyou is necessary for (@.syain_No nvarchar(4), @.date_kyou nvarchar(12), and @.time_kyou nvarch Ceri of making to the parameter ''. )
Exception Details:System.Data.SqlClient.SqlException: パラメータ化クエリ '(@.syain_No nvarchar(4),@.date_kyou nvarchar(12),@.time_kyou nvarch' にはパラメータ @.time_kyou が必要ですが、指定されていません。
Source Error:
Line 117: sqlcom.Parameters.AddWithValue("@.ninka_date_kyou", textbox_approval_date.Text)Line 118:Line 119: sqlcom.ExecuteNonQuery()Line 120: MyConn.Close()Line 121: sqlcom.Dispose()
Source File:C:\Documents and Settings\mspitc5\My Documents\Visual Studio 2005\MSPITC_project\overtime_application_approval_inputt.aspx.vb Line:119
Stack Trace:
&&&
it produces different error...
|||Hi,
can you check if all the parameters are created and input with valid values?
if it doesn't solve the problem, would it be possible to translate the japanese words in your error statements as not many of us here understands it...
but i think you can narrow down the problem to the parameter @.time_kyou
Dim sqlcom As SqlClient.SqlCommand = MyConn.CreateCommand()
MyConn.Open()
sqlcom.CommandType = CommandType.Text
sqlcom.CommandText = "update TE_zangyou Set ninka_nen_from = @.ninka_nen_from ,ninka_gatsu_from = @.ninka_gatsu_from, ninka_hi_from = @.ninka_hi_from ,ninka_nen_to = @.ninka_nen_to, ninka_gatsu_to = @.ninka_gatsu_to, ninka_hi_to = @.ninka_hi_to, ninka_ji_from = @.ninka_ji_from,ninka_ji_to = @.ninka_ji_to,ninka_bun_from = @.ninka_bun_from,ninka_bun_to = @.ninka_bun_to,ninka_day_name_from = @.ninka_day_name_from,ninka_day_name_to= @.ninka_day_name_to,ninka_date_kyou= @.ninka_date_kyou where syain_No = " + Request.QueryString("syain_No")+ " and date_kyou ='" + Request.QueryString("date_kyou") + "' and time_kyou ='" + Request.QueryString("time_kyou") + "'"
sqlcom.Parameters.AddWithValue("@.ninka_nen_from", TextBox1.Text)
sqlcom.Parameters.AddWithValue("@.ninka_gatsu_from", TextBox2.Text)
sqlcom.Parameters.AddWithValue("@.ninka_hi_from", TextBox3.Text)
sqlcom.Parameters.AddWithValue("@.ninka_day_name_from", TextBox5.Text)
sqlcom.Parameters.AddWithValue("@.ninka_ji_from", textbox_from_hr.Text)
sqlcom.Parameters.AddWithValue("@.ninka_bun_from", textbox_from_min.Text)
sqlcom.Parameters.AddWithValue("@.ninka_nen_to", TextBox6.Text)
sqlcom.Parameters.AddWithValue("@.ninka_gatsu_to", TextBox7.Text)
sqlcom.Parameters.AddWithValue("@.ninka_hi_to", TextBox8.Text)
sqlcom.Parameters.AddWithValue("@.ninka_day_name_to", TextBox9.Text)
sqlcom.Parameters.AddWithValue("@.ninka_ji_to", textbox_to_hr.Text)
sqlcom.Parameters.AddWithValue("@.ninka_bun_to", textbox_to_min.Text)
Label28.Visible = True
textbox_approval_date.Visible = True
textbox_approval_date.Text = Date.Today
statusbox_approve_mesg.Visible = True
sqlcom.Parameters.AddWithValue("@.ninka_date_kyou", textbox_approval_date.Text)
sqlcom.ExecuteNonQuery()
MyConn.Close()
sqlcom.Dispose()
MyConn.Dispose()
MsgBox(" Application Dates was Approved")
TextBox1.Enabled = False
TextBox2.Enabled = False
TextBox3.Enabled = False
TextBox6.Enabled = False
TextBox5.Enabled = False
TextBox7.Enabled = False
TextBox8.Enabled = False
TextBox9.Enabled = False
textbox_from_hr.Enabled = False
textbox_from_min.Enabled = False
textbox_to_hr.Enabled = False
textbox_to_min.Enabled = False
Reason.Enabled = False
compensantory.Enabled = False
Edit1.Visible = False
Button_save.Visible = False
Button_approve.Visible = False
Button_reject.Visible = False
Button_send.Visible = True
&&&& my code... what u think? there is an error in thebold words
and date_kyou and time_kyou are character string only...
its only character string... and its working when i just put requerystring(syain_No) but when i included the date_kyou and time_kyou,.,,, it produces that kind of error...
what do u think is the problem here?
&&&
error
ived been properly arranging the quotes and single quotes but still it has error...it changes the error but has error still...
wat u think about it?
'2006' 付近に不適切な構文があります。 (There is an improper syntax in the vicinity ..'20 06'... )
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Data.SqlClient.SqlException: '2006' 付近に不適切な構文があります。
Source Error:
Line 113: sqlcom.Parameters.AddWithValue("@.ninka_date_kyou", textbox_approval_date.Text)Line 114:Line 115: sqlcom.ExecuteNonQuery()Line 116: MyConn.Close()Line 117: sqlcom.Dispose()Hi,
im assuming that your data type fordate_kyou andtime_kyou are nvarchar(12)
what is the value of the query string?
kindly check if theres any ' in your querystring which will spoil your sql statement.
to minimise this error, use <string>.Replace("'", "''")
Example:
Cstr(Request.QueryString("time_kyou")).Replace("'", "''")
im afraid if this doesnt work you would have to provide the actual value of the query string...