Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
i am using ms access for database i want fall item when click in textbox it. ONE thing clear i don't want to use module and class i want to type code in form class and form load ...............don't say we won't type for YOU ...or show the coding..please help if can sorry
Posted
Comments
Sergey Alexandrovich Kryukov 26-Jan-12 15:40pm    
"Fall item"? What is that supposed to mean?
--SA
[no name] 26-Jan-12 15:42pm    
it means data stored in database like name,employee id, model no , phone.no
loctrice 26-Jan-12 15:56pm    
yes, but "Fall item" is vague and does not convey what you want to do.
ZurdoDev 26-Jan-12 16:05pm    
Does fall item mean to read data from the database and put it into the textbox?

1 solution

I'm not really sure what you mean but... this is somthing i use to put call items from a MSDB, if you can pull something from this and solve your problem then you are welcome to it :)

VB
Public Structure NewsItems
    Dim Title As String
    Dim Messege As String
    Dim DateNews As String
End Structure
Public Shared Function Function_NewsItems( _
ByRef Requested As String) As NewsItems
    Dim DBConn As New OleDbConnection(ProviderJet4 + _
    System.Web.HttpContext.Current.Server.MapPath( _
    "../App_Data/NewsNotice.mdb"))

    Dim DBQueryStr As New StringBuilder
    DBQueryStr.Append("SELECT TOP " + Requested + _
                      " ID, NewsDate, NewsTitle, NewsMessage ")
    DBQueryStr.Append("FROM GlobalNews ")
    DBQueryStr.Append("ORDER BY ID DESC ")

    Dim Get_NewsItems As NewsItems 'Change For Easy Reading
    Dim RawDate As Date
    Get_NewsItems.DateNews = Nothing 'Clean Structure Value
    Get_NewsItems.Messege = Nothing 'Clean Structure Value
    Get_NewsItems.Title = Nothing 'Clean Structure Value

    Dim DBCommQuery As String = DBQueryStr.ToString
    Try
        DBConn.Open()
        Dim DBComm As New OleDbCommand(DBCommQuery, DBConn)

        Dim DBReader As OleDbDataReader = DBComm.ExecuteReader()
        While DBReader.Read()
            RawDate = DBReader.Item(1)
            Get_NewsItems.Title = DBReader.Item(2)
            Get_NewsItems.Messege = DBReader.Item(3)
            Get_NewsItems.DateNews = RawDate.ToString("dd'" + _
            DayDateSuffix(RawDate.Day) + "' MMMM yyyy")
        End While
        DBConn.Close()
    Catch ex As Exception
    Finally
        DBConn.Dispose()
    End Try

    Return Get_NewsItems
End Function


Once this function has run you can simply use somthing like this...

VB
Dim Output1 = App_Static.Function_NewsItems("1")

Me.SBL_News_Literal_TextBox.Text = Output1.Title + _
                                   vbNewLine + _
                                   Output1.Messege + _
                                   vbNewLine + _
                                   Output1.DateNews



Remember this is somthing from one of my own projects and is just a pointer.
Good Luck.
 
Share this answer
 

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