Click here to Skip to main content
15,910,981 members
Please Sign up or sign in to vote.
1.25/5 (4 votes)
See more:
we have stored file creation date and time to the database. now how to retrive it from database in vb.net?
Posted
Comments
Orcun Iyigun 22-Mar-12 14:57pm    
What have you TRIED so far? Have you searched it in Google? I am sure you will find millions of results to your question...
[no name] 22-Mar-12 14:58pm    
How did you store it in the first place?

You seriously need to at least try something before asking. There is so much information available for this it is difficult to believe anyone who has at least put some effort into research hasn't blindly stumbled upon anything.
 
Share this answer
 
Your question is way too vague. It all depends on what kind of database and how your database is setup. You haven't even told us if you are trying to access this from a windows forms project or a web project.

It sounds like you need to do some research. Try google[^] for some basic tutorials. Or you can read some of the articles[^] here on CodeProject. When you run into a more specific problem, then come back here and post the code you are working with and any error messages you get and we can help you.
 
Share this answer
 
Hello

One of the solution is creating a stored procedure in your database (SQL Server)

For example:
Create
SQL
Procedure   SelectDateTime
(
    @FileName   as  NVarChar(128),
    @FilePath   As  NVarChar(256)
)
As
Begin
        Select  *   From    MyTable
                        Where   MyTable.FileName = @FileName    And
                                    MyTable.FilePath =  @FilePath
End


Then you execute call your Stored Procedure from VB.Net


VB
Dim sqlConnection1 As SqlConnection = New SqlConnection("The Connection String")
Dim cmd As SqlCommand = New SqlCommand
Dim reader As SqlDataReader
cmd.CommandText = "SelectDateTime"
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = sqlConnection1
cmd.Parameters.Add(New SqlParameter("@FileName", fileName))
cmd.Parameters.Add(New SqlParameter("@FilePath", filePath))
Try 
     sqlConnection1.Open
     reader = cmd.ExecuteReader
Catch ex As Exception
     
Finally
     sqlConnection1.Close
End Try


One of the other solutions is using ADO.Net Entity Framework.
Look at these

http://msdn.microsoft.com/en-us/data/ee712907[^]

http://msdn.microsoft.com/en-us/data/aa937723[^]
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900