|
alex1205 wrote: Thanks for the response. I've tried that and it doesn't work.
Oh, sorry about that. I take it the Connection State is showing the connection is still active?
alex1205 wrote: it raises an error when you execute something even if the connection has been restored.
In the original post you mention the next time you execute a query it throws an error. What is the error message it throws when this happens?
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
Hi all,
I have a question on sql writing
for a table schema as below
Table :
(studentID, studentName, courseID, classID, Age)
What is the correct sql of " select studentID from table where classID = "101" and group by courseID and order by age " ? (ie. Group by courseID, and within the same courseID, the studentID are ordered by age)
Thanks
|
|
|
|
|
SELECT studentID
FROM table
WHRERE classID = "101"
GROUP BY courseID
ORDER BY age
By default, ORDER BY will go in ascending order, if you want descending order use ORDER BY age DESC
Does this help?
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
i've used ASP.NET with Microsoft Access Database before.
Now i would to learn how use (create database, create table, create references, add values, update, delete...) SQL databases with ASP.NET (c#).
Can you indicate me a good web tutorial?
|
|
|
|
|
SQL Server BOL [Books On-Line] (i.e. the built in online-help that comes with SQL server and it available on MSDN) have some excellent examples at the bottom of the pages on each of these T-SQL statements. All you have to do in C# is remember that you can run any T-SQL you like through the SqlCommand object.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
We recently had a fire on campus. So we had to move all our data to new servers. The servers are supposed to be identical. I built a large DTS package to move some data into a database. I also made it a scheduled job, and a vb app that calls the scheduled job so our end users can run it by themselves. It was working fine in the previous servers. Now, if I run the DTS package, it works fine. If I try to run the Scheduled Job through Enterprise Manager or through the VB app it fails. Here is the error I get:
Executed as user: server\user. DTSRun: Loading... DTSRun: Executing... DTSRun OnStart: DTSStep_DTSExecuteSQLTask_1 DTSRun OnFinish: DTSStep_DTSExecuteSQLTask_1 DTSRun OnStart: DTSStep_DTSActiveScriptTask_1 DTSRun OnError: DTSStep_DTSActiveScriptTask_1, Error = -2147220482 (800403FE) Error string: ActiveX Scripting encountered a Run Time Error during the execution of the script. Error source: Microsoft Data Transformation Services (DTS) Package Help file: sqldts80.hlp Help context: 4500 Error Detail Records: Error: -2147220482 (800403FE); Provider Error: 0 (0) Error string: ActiveX Scripting encountered a Run Time Error during the execution of the script. Error source: Microsoft Data Transformation Services (DTS) Package Help file: sqldts80.hlp Help context: 4500 DTSRun OnFinish: DTSStep_DTSActiveScriptTask_1 DTSRun: Package execution complete. Process Exit Code 1. The step failed.
I am not sure why it will work if the DTS package is started by me, but not through the scheduled job. I have been working on this for days and I really don't know what else to try, any help would be GREATLY appreciated.
|
|
|
|
|
I have a DTS package, it works fine if I execute it in Enterprise manager. I set up a scheduled job for it, but if I try to start that job it fails. So it works if I run the DTS package, but not if I try to run the job that calls the package. I read the error message and it says it is trying to execute the DTS package as a local user instead of a domain user. In the DTS I have some files moving to another server, so that is what is causing the failure. How can I get the scheduled job to run as a different user?
|
|
|
|
|
I just made a BIG, STUPID mistake. I deleted all the .resx and .aspx.vb files on my machine through Dreamwaver Test Server view! It will kill me to re-write all the code .
I have recently re-built the project into .DLL file before deleting those files. Is there anybody know how to decompile .DLL file to get source code back????
I also find there is a tempporary folder "_vti_cnf" under my wwwroot/project folder. In this folder, there are .aspx.vb and .RESX files. However, .aspx.vb file only contains the information like :
vti_encoding:SR|utf8-nl
vti_timelastmodified:TR| 17 Oct 2005 16:58:30 -0000
vti_extenderversion:SR| 4.0.2.8912
Could anybody help me out???
Thank you in advance!!!!!
|
|
|
|
|
See http://www.aisto.com/roeder/dotnet/[^]and get Reflector.NET
It won't get your aspx pages back, but it will produce something that looks sort of similar to your original source code.
Also, it might be a good time to consider the benefits of backing up your work from time to time. You may also want to consider using a source control system even if you are working alone - It is a very good discipline and at anytime you can go back and see previous versions.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
-- modified at 4:14 Thursday 10th November, 2005
|
|
|
|
|
hi colin,
as i ear you talking about source control system, i'd like to ask you.
i've installed TortoiseCVS on my computer, at home (i work alone on my projects). for now, the server and the source files source controled are located on the same computer. but i don't really find out how to :
1. configurate the server,
2. inserting files to be source controled
since this is quite in my hand, i'll then try to use a deported server on another computer. i think the two points i was ask previously remain the same, with the exception that the server will probably not be configured the same way.
do you have any idea of how TortoiseCVS work, how this can be reached, or at least, any tutorial links to point me the right way ?
thanks in advance,
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 6:34 Thursday 10th November, 2005
|
|
|
|
|
Sorry, I don't know about TortoiseCVS
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
toxcct wrote: i've installed TortoiseCVS on my computer, at home
I experimented with CVS and wasn’t impressed with it (even TortoiseCVS). Subversion SVN on the other hand has some pretty decent documentation, and supports binary files. Basically it’s a better version of CVS, written by the same people who wrote CVS.
Subversion can be found at subversion.tigris.org[^]
The Subversion book can be found Version Control with Subversion[^]
TortoiseSVN (which much like Tortoise CVS can act as both client and server) can be found here. http://tortoisesvn.tigris.org/[^]
[edit]
I don’t know about Tortoise CVS, but Tortoise SVN counter part comes with a decent HTML help file that shows how to configure it for both client and server role. I had thought of writing an article about subversion, but the more I looked the more information I found (in plain site).
[/edit]
Hope that helps Toxcct, if you have any problems I would be glad to try and help.
DEBUGGING : Removing the needles from the haystack.
-- modified at 6:59 Monday 14th November, 2005
|
|
|
|
|
Thank you very much for your help!
Luckly, I have all .aspx files on the remote server. Now I am using Reflector to decompile the project .DLL file to get readable source code to reconstruct my source code.
It's such a pain! But I have hope now...
|
|
|
|
|
hi everybody,
I have a small proplem with my stored procedure that looks like this
create procedure MonthlyBill @startDate datetime, @endDate datetime as
select * from Bills where Bills.date >=@startDate and Bills.date<@endDate
the problem I have is that when I execute this query using the following command:
execute MonthlyBill '01/10/2005','30/10/2005'
I get the following error msg: Error converting data type varchar to datetime.
both @endDate and @startDate are declared as datetime variables.From where does come the problem?I anybody knows and would like to help please do!!!I'm thankfull
The will to learn
|
|
|
|
|
You need to convert from the varchar type to the datetime type. This might help.
execute MonthlyBill to_date('01/10/2005','DD/MM/YYYY') to_date('30/10/2005','DD/MM/YYYY')
Hopefully whatever DB platform you are using, there is a function, 'to_date' that will translate a varchar to a datetime.
Chris Meech
I am Canadian. [heard in a local bar]
Remember that in Texas, Gun Control is hitting what you aim at. [Richard Stringer]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
Look at this example stored procedure:
<br />
create procedure MonthlyBill <br />
@startDate datetime, <br />
@endDate datetime <br />
as<br />
select * from Bills where Bills.date >=convert(datetime,@startDate, 102) and Bills.date<convert(datetime,@endDate, 102)<br />
then you can call the stored procedure like this:
exec MonthlyBill '2005/10/1', '2005/10/30'
I actually use this source[^] to use stored procedures and I forget about type cast problems. Take a look at it, it's really good.
daniero
|
|
|
|
|
One note I would like to add to the other respondents. I am not a big fan of using operators when comparing datetimes. If, for example, one of your parameters is using GetDate() (sql server) the <,> etc operators check the time. This can lead to very undesirable results! If you are not interested in the time, it is better to use DATEDIFF(dd,date1,date2) < 0. You'll find yourself chasing down less problems this way.
|
|
|
|
|
I have a windows program that basically takes data from an MS Access DB and updates a SQL Server table. Then it clears the Access Table and inserts ALL the records from the SQL Server to the MS Access DB. Everything works except the very last step. I have tried the OleDbDataAdapter.Update Method and also used a loop and a dynamic SQL statement to update the Accesss DB with no luck. Does anyone have any suggestions? I know my DataSet has data in it because I can count the rows and also look at the data using GetXML method. Code below:
Try
Dim accessDS2 As New DataSet
sqlDA.SelectCommand = New SqlCommand("SELECT nameFirst, nameLast, phonenumber, addressStreet1, addressStreet2, addressCity, addressState, addressZip, addressEmail, dateAvailable, JobFairs, areaCert1, areaCert2 FROM tb_HR_Recruits", SqlConn)
sqlDA.Fill(accessDS2)
MsgBox(accessDS2.GetXml())
Dim accessInsertCmd As String
Dim nRow As AccessDS2.tblRecruitInfoRow
Dim x As Integer
For Each nRow In AccessDS2.tblRecruitInfo
accessInsertCmd = "INSERT INTO tblRecruitInfo VALUES (" & nRow.nameFirst & "," & nRow.nameLast & "," & nRow.phoneNumber & "," & nRow.addressStreet1 & "," & nRow.addressStreet2 & "," & nRow.addressCity & "," & nRow.addressState & "," & nRow.addressZip & "," & nRow.addressEmail & "," & nRow.dateAvailable & "," & nRow.jobFairs & "," & nRow.areaCert1 & "," & nRow.areaCert2 & ")"
accessDA.InsertCommand = New OleDbCommand(accessInsertCmd, accessConn)
accessDA.InsertCommand.ExecuteNonQuery()
Next
'accessDA.Update(accessDS2)
Catch ex As Exception
MsgBox(ex.Message)
Finally
SqlConn.Close()
'accessConn.Close()
lblDone.Text = "Sync Complete."
End Try
|
|
|
|
|
Hi All
I have a simple Access database that consists of two tables, one for staff details (name, telephone, job title etc) and one as a look-up table that holds valid data for job titles (Technician, Scientist etc). I've created the database like this because I want to limit the selectable job titles in a C# ADO.Net application when data about new staff is added.
Now I want to display information about staff on a simple windows form that has say three text boxes on it. One text box displays the name, one the telephone and the other should display the job title as referred to in the look up table. I don't want to amend anything, just display the uneditable details.
Can anyone point me in the right direction of how to proceed? I have had all manner of problems with datasets and dataadapters. Anyone got or know of any examples that do the same sort of thing in C#?
Any help would be gratefully appreciated.
Billy
|
|
|
|
|
Billy Whizz wrote: C# ADO.Net application when data about new staff is added
While I'm not familiar with C# the concepts you need are pretty simple.
Billy Whizz wrote: I've created the database like this because I want to limit the selectable job titles
Use a combo box to with approved job titles; only allow items in the combo box to be selected.
Billy Whizz wrote: Now I want to display information about staff on a simple windows form that has say three text boxes on it. One text box displays the name, one the telephone and the other should display the job title as referred to in the look up table
Display your data, disable the three edit boxes. Or open the data adapter read only.
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
ANyone any idea how to manually remove SQL Native client Beta2, the remove tool fails and i cant even find the files .
Im trying to install the express sql.
Thanks
.nuetter
|
|
|
|
|
I have hard disk of 40 gb for d:.Now i am creating a test environment for a database that should hold more than 1 cr records in one of the tables.I am imorting data from flat files .It gives me primary filegroup full .So i created a secondary filegroup and created the table in this filegroup.After 40 lakh data the hard disk space left is 32 gb still it gives me filegroup full error while importing data.Databse growth is unrestricted.help
|
|
|
|
|
how can i list all sql server currently running on a network?
is there have any system stored procedure for this.
|
|
|
|
|
|
yes i have searched
and i got the following code
using System.Data;
using System.Data.Sql ;
using System;
public class Repro
{
public static int Main(string[] args)
{
SqlDataSourceEnumerator sqldatasourceenumerator1 = SqlDataSourceEnumerator.Instance;
DataTable datatable1 = sqldatasourceenumerator1.GetDataSources();
foreach (DataRow row in datatable1.Rows)
{
Console.WriteLine("****************************************");
Console.WriteLine("Server Name:"+row["ServerName"]);
Console.WriteLine("Instance Name:"+row["InstanceName"]);
Console.WriteLine("Is Clustered:"+row["IsClustered"]);
Console.WriteLine("Version:"+row["Version"]);
Console.WriteLine("****************************************");
}
return 1;
}
}
'but i not get the dll for
system.data.sql namespace
|
|
|
|
|