|
Mazdak wrote:
Do we have something like GetDate() in Access?
Oh, in VB you need to use Now() . You can also format it such as:
d = Format(Now, "mm/dd/yyyy")
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
Hi Nick:
I need to used GetDate() in a query that Access does not support it.I don't use VB.I use C#.
Anyway thanks.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
The previous CPian gave you the correct answer. The equivalent function for getDate() in MsAccess is Now(). It will work in both an isert query and as the default value for a date/time field: "INSERT INTO MyTable( Mydate) SELECT Now() AS Expr1"
or
"INSERT INTO MyTable( Mydate) Values( Now())"
Some ideas are so stupid that only an intellectual could have thought of them - George Orwell
|
|
|
|
|
Oh,I got it. Thanks.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
When binding a datagrid, one of the columns calls a function to process the "Status" field. However, sometimes that field is not there - sometimes I get the exception "Status is neither a DataColumn nor a DataRelation for table ABC".
So I used an IF statement to check if that field is Nothing, but that too caused the exception to be thrown.
How do I determine if a datarow contains a particular column?
|
|
|
|
|
Never mind. I discovered the Contains function on DataRow.Table.Columns .
|
|
|
|
|
|
I'm creating a contract database that has over 80 different calculations and formulas. I'm using one table with fields and one query for formulas. I need to run/update query through the browser. Does anyone have any idea how this should be done? I'm using this SQL statement in the query, maybe there is a better SQL statement I can use to automatically update my fields in the table? Please help!
I appreciate any help from you guys.
|
|
|
|
|
|
1. I have an application (SDI) which works with database
that is, retrieves data and the data are displayed in Edit Boxes and Statics
I want to send these data to another program, MS Word in my case
how to do this ?
2. Is it possible with ADO?
thank you.
|
|
|
|
|
You ought to use WinWord's COM API, e.g. create a new Word document, insert a table, and fill it in with the data from your database.
Alexandre Kojevnikov
MCP (SQL2K)
Leuven, Belgium
|
|
|
|
|
I want to count the number of records.... and display it in my web-page using my ASp page. I know that the "Select count(*) from table" will give the count in the database.
How can I retrive the 'result' from that query and pass it on to my ASP page??
Any help?
I was born intelligent Education ruined me!.
|
|
|
|
|
Off the top of my head it goes something like this (there might be some mistakes since I haven't tested it):
<script language=vbscript runat=server>
Dim ADOConn
Dim ADORs
Dim RecordCount
set ADOConn = CreateObject("ADODB.Connection")
ADOConn.Open(myConnectionString)
set ADORs = ADOConn.Execute("select count(*) as NumRecords from MyTable")
if not ADORs.BOF and not ADORs.EOF then
RecordCount = ADORs.Fields("NumRecords").Value
end if
ADORs.Close
ADOConn.Close
Response.Write "# Records: " & RecordCount
</script>
|
|
|
|
|
The fact that you're using a <script runat="server"> tag says that you're using .NET.
Therefore:
1. Use .NET the proper way with code behinds and a literal control
2. Use .NET the proper way with ADO.NET rather than ADO and late binding
Those are where your problems lie - your using legacy code in a new environment.
If you use ADO.NET, to get your record count just go get the value of myDataset.Tables(0).Rows.Count .
Tatham Oddie (VB.NET/C#/ASP.NET/VB6/ASP/JavaScript)
tatham@e-oddie.com
+61 414 275 989
|
|
|
|
|
Actually, you're wrong there.
The <script runat="server"> tag was there long before .NET was developed. It's how script is run server-side in ASP.
Tatham wrote:
Those are where your problems lie - your using legacy code in a new environment.
Since the grandparent post asked for "ASP" and not "ASP.NET", I answered using VBScript which is the de-facto standard for using server side scripting in ASP.
Not everyone is using .NET yet.
|
|
|
|
|
I just installed SQL Server on my machine, and found that it was
really slow! I even had to wait for quite a while when
create a table or open an empty table in the Enterrpise
Manager. Accessing it from a program is also painfully
slow. I got SQL Server SP2 installed as well, but didn't
solve the problem. Any ideas?
Thanks a lot!
Wenrich
|
|
|
|
|
What machine/spec are you running it on? Memory, OS, Clock-Speed, Harddisk ( fragmentation) all plays a part on the overall speed.
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
|
You can try to reinstall.
|
|
|
|
|
what is the easiest way to count the total records in C#? can I have an example please?
Jassim Rahma
|
|
|
|
|
Select count(*) from tablename
This will return one record and its number of records.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Use alias name:
Select Count(*) as total from tablename
Display result:
response.write(rs("total"))
dungnv
|
|
|
|
|
Hi all,
I have a disconnected dataset in a remoting smart client application.
If I insert and update rows at client data set, I can send it back to the server, call the Update() command and everything works fine.
However, when I delete a row and send the dataset back to the server, I get a concurrency violation and the database is not modified.
So update and insert work, delete doesn't.
Any ideas why this could be? I lost a whole day looking for a solution but still haven't found it :-/
Kind regards,
Ludwig
Ludwig
|
|
|
|
|
Use GetChanges() function.
p.s:Do you use Access or SQLServer?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Hi there,
well, in short, I use the following approach:
- at client side, I have a typed dataset connected to a listbox. If I select an item in the listbox and hit a delete button, that dataset is serialized and sent to the server through the http-channel.
- at server side, it is deserialized and written to the database:
SqlDataAdapter sqlda = new SqlDataAdapter("select * from tbSearch", sqlcon)
SqlCommandBuilder sqlcomb = new SqlCommandBuilder(sqlda);
sqlda.Update(dsetUserSearches, dsetUserSearches.tbSearch.TableName);
dsetUserSearches.AcceptChanges();
I then send this dataset dsetUserSearches back to the client, where it is merged with the client dataset:
dsetUserSearches.Merge(us, false);
This works with updates and insertions, but it does not when I delete items in the listbox. The strange thing is, that it works the first time, it doesn't the second time, it does the third time, it doesn't the 4th time, etc...
The error I get is 'concurrency violation'.
I'm stuck here....
PS - I'm using sql server
Ludwig
|
|
|
|