|
Brutaldeath0 wrote:
a query suing Time format
I want to know the row(s) in which a Time Field is = to 15h00
I'm not a lawyer - but you could try for a John Doe lawsuit.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
Okay, it's been a long day... Here is a more serious answer....
SELECT * FROM MyTable WHERE datepart(hour, TimeField) = 15
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
why not just use the LIKE clause. LIKE '15h00'. aren't dates stored as varchars, if not then you'd need to cast somehow. im just giving this advice from a programmers perspective
|
|
|
|
|
Hello to all,
How can i lock records or a table in transaction using MS Access database and VB.NET.
My experiments shows that this is imposible.
What do you think about it?
Regards Alex
|
|
|
|
|
Yes, it is definitely possible to do transactions with MS Access. You can use either ODBC or classes from the System.Data.OleDb namespace.
My articles and software tools
|
|
|
|
|
I understand you. And I allready using .NET classes to acces the data in the MS Access database, but there are only three methods supported by this database:
1 Chaos
2 ReadCommitted
3 ReadUncommitted
and they can't give me full functionality that I need.
I need lock records in the database table or if it's imposible then lock all table.
That all I want.
Regards Alex
|
|
|
|
|
Do the ADO.Net DataSets contain any kind of support for the [binary] serialization of objects?
Ideally, I'd like to be able to set a reference to a field, as if it was a value, which has its insertion in as a string/BLOB automated.
At the moment my only solution would be to dump DataSets and use custom objects with DataReaders.
|
|
|
|
|
How to check whether SQL server is installed on my machine?
How to create a new MSDE database?
I would like to create a new MSDE database.
|
|
|
|
|
Prasad N wrote:
How to check whether SQL server is installed on my machine?
http://www.codeproject.com/csharp/servercombobox.asp[^]
Prasad N wrote:
How to create a new MSDE database?
You should run commands I think. Start with CREATE DATABASE in SQLServer online boook.
Mazy
"I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
|
|
|
|
|
i am recently working on a project regarding database conversion. i am facing a problem in converting the stored prodcedures of oracle to sql server in vb.net or by using ado.net, can someone help me out in this matter.
thanks.
|
|
|
|
|
If you have a PL/SQL Stored Procedure, your best bet would be to convert it to a T-SQL stored procedure. Have a look at the SQL Server Books On Line for full details.
|
|
|
|
|
Is there a way to call a column by index rather than by its name. I'd like to crawl to a specific column, as in:
SELECT {column + 2} FROM Table
Similar to how you would refer to an element in a C++ array using pointer arithmetic.
|
|
|
|
|
Simple answer: no.
Complicated answer: if the column was called Coln (e.g. Col2) you could probably use sp_executesql (preferred) or EXEC to construct some dynamic SQL.
SQL is very good in the vertical direction, finding rows which match particular criteria; it's very weak in the horizontal.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
OK, I see what you mean. It's basically the way SQL works. I guess I'll just have to use a bunch of IF statements and choose the column based on the index I give it. It's not a big deal, I was just in a more dynamic frame of thought.
|
|
|
|
|
hi
in my app i have a recordset associated with paradox 5 table created by
Borland's Database Desktop 7. (not DAO just crecordset)
and i have a strange situation here:
if (!pDoc->m_rentedFMDBSet.IsOpen())
return;
pDoc->m_rentedFMDBSet.Requery();
int z = pDoc->m_rentedFMDBSet.m_FilmNr;
// in recordset data members is ok data
z = pDoc->m_rentedFMDBSet.CanUpdate(); z > 0
z = pDoc->m_rentedFMDBSet.IsBOF(); z == 0
z = pDoc->m_rentedFMDBSet.IsEOF(); z == 0
z = pDoc->m_rentedFMDBSet.IsDeleted(); z == 0
TRY
{
pDoc->m_test2Set.Delete();
}
CATCH(CDBException, e)
{
AfxMessageBox(e->m_strError);
return;
}
END_CATCH
and i have always exception. TRACE says sth like this:
"update or delete operation had no effect on any row"
i must say that sometimes (when i create new table and add some values
it works, but from my point of view it's random behavior for now)
help
|
|
|
|
|
To simplify date conversion i was adviced to use to integer converted dates i.s.o. the datetime type.
Now i have the integer 37954 which resembles 01-12-2003 (dd-mm-yyyy)
select cast(37954 as datetime) as startdate
But VB6 thinks it is 29-11-2003
?Format(37954, "dd-mm-yyyy")
How is this possible? What am i doing wrong?
Grtz,
Guus
|
|
|
|
|
Doing this will give you a major headache. Use the datetime data type. If you need to use date literals, specify them in the ISO format: 'yyyymmdd' (e.g. today would be '20040401').
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks for the good advice but it doesn't answer my question. How is it possible that an integer converted to a date results in two different dates on VB vs SQL Server?
|
|
|
|
|
VB6's built-in dates use OLE's DATE format - an 8-byte floating point number based on 30 December 1899 = 0.0, with the time represented as a fraction.
SQL Server's datetime data type is made up of two four-byte signed integers, based on 1 January 1900. The documentation reads:
"Values with the datetime data type are stored internally by Microsoft SQL Server as two 4-byte integers. The first 4 bytes store the number of days before or after the base date, January 1, 1900. The base date is the system reference date. Values for datetime earlier than January 1, 1753, are not permitted. The other 4 bytes store the time of day represented as the number of milliseconds after midnight."
When converting to and from integers, both VB6 and SQL Server simply use their own internal representations, which is why they produce different values.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
That's the answer i was looking for. Thx!
Grtz,
Guus
|
|
|
|
|
Have you tried storing dates as strings?
Easy to display in the format you want and easy to convert correctly to date/time format for any calculations that you need to perform on them.
Jon
|
|
|
|
|
Hi, jonathan15
I hope you can help me... I store an elapsed time value as a string (mm:ss) in my SQL database. When I query the data from Excel, how can I calculate an average from this data? Would it help if I made the SQL datatype some kind of time value?
Thanks in advance for any advice you may provide.
'til next we type...
HAVE FUN!! -- Jesse
|
|
|
|
|
Jesse,
Depends on what you want to do and how you want to get the information into excel really. If you are doing a query to get the raw data into excel and average the results from there you could use something like the following in your Query
"select table1.duration, (cast(left(table1.duration,2) as int) *60)+cast((right(table1.duration,2))as int) as seconds from table1"
assuming the duration is MM:SS, this will add a field called 'Seconds' which would be a numeric value to your query. it would then be simple to average the seconds using an excel function.
Jonathan
|
|
|
|
|
Hie... I have faced this problem when I set my data grid - AllowCustomPaging to True.
Please advice as soon as possible?
Server Error in '/DNSS' Application.
------------------------------------------------------------------------------
AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID Tel when AllowPaging is set to true and the selected datasource does not implement ICollection.
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.Web.HttpException: AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID Tel when AllowPaging is set to true and the selected datasource does not implement ICollection.
Source Error:
Line 14: DbReader = dbcomm.ExecuteReader()
Line 15: Tel.DataSource = DbReader
Line 16: Tel.DataBind()
Line 17: DbReader.Close()
Line 18: DbConnection.Close()
Source File: d:\inetpub\wwwroot\DNSS\AccessDataCon\OlelDataReader.aspx Line: 16
Stack Trace:
[HttpException (0x80004005): AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID Tel when AllowPaging is set to true and the selected datasource does not implement ICollection.]
System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource) +2068
System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +49
System.Web.UI.WebControls.BaseDataList.DataBind() +23
ASP.OlelDataReader_aspx.Page_Load() in d:\inetpub\wwwroot\DNSS\AccessDataCon\OlelDataReader.aspx:16
System.Web.Util.ArglessEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +10
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
|
|
|
|
|
Hi,
I using http://support.microsoft.com/?kbid=320301 as a guide to building a
webservice with a collection of methods for requesting and updating data.
The client will request some data, change it/add more rows, then send it
back to be updated on the server. When the client adds a new row I would
like the identity of the row to be negative, start at -1 and move down.
However when I'm populating the dataset I have to use
FillSchema(ds,SchemaType.Mapped,"Details") if I want the Merge method to
work properly. This prevents my id's from starting at -1, infact it causes
conflicts. Because if the last id in the database is 60, then new rows
added by the client will start at 59. Is there anyway to resolve this? Or
should I omit the FillSchema method and just remove rows with negative id
when the merge is complete? As the client devices are handles, I would like
to keep any extra steps to a minimum.
Any help would be greatly appreciated,
Mark
|
|
|
|