₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,001 members, 8,419,875 topics. Date: Thursday, 04 June 2026 at 05:57 AM

Toggle theme

ABAboi's Posts

Nairaland ForumABAboi's ProfileABAboi's Posts

1 2 3 4 (of 4 pages)

ProgrammingRe: Vb.net Code To Display Image In Picturebox From Sql Server by ABAboi: 9:08pm On Nov 24, 2009
Omosilade:
Hi Ababoi,

Weldone. But i need second part of the code, and how to modify and optimise the code. Please, let the second part follow the trent you used in the first part. I need it urgently. demola4infotekk@yahoo.com
other ways you can modify the code includes searching and displaying an image using the values of a textbox.
The second part of the code is to display the image from the database (assuming that you have actually created the imageData table and contain values). You will need
picturebox, image1,
textbox , textbox1
then
under the button to display the image ::
'Read an image
Using conn As New System.Data.SqlClient.SqlConnection("[s]Data Source=DENSMAN-PC\SQLEXPRESS;Initial Catalog=aba;Integrated Security=True[/s]"wink 'insert ur connection string
conn.Open()
Using cmd As New SqlClient.SqlCommand("Select Name, CreateDate, Picture From ImageData", conn)
Using dr As SqlClient.SqlDataReader = cmd.ExecuteReader()
Using dt As New DataTable
dt.Load(dr)
Dim row As DataRow = dt.Rows(0)
Dim sName As String = Convert.ToString(row("Name"wink)
Dim dtCreateDate As DateTime = Convert.ToDateTime(row("CreateDate"wink)
Using ms As New IO.MemoryStream(CType(row("Picture"wink, Byte()))

Dim img As Image = Image.FromStream(ms)
Image1.Image = img
End Using
TextBox1.Text = ("Loaded image " + sName)
End Using
End Using
End Using
End Using

Goodluck try it and if not working reply and show ur error. Else notify when it is working

End Sub
ProgrammingRe: Multiple Login Control by ABAboi(op): 9:18pm On Nov 23, 2009
Thanks guys for your inputs. I managed to do it. I used to a while loop to read the column(Access Level which happens to be the third column) while authenticating the user. The sample code below was wat i did. Once again thanks

If theReader.HasRows Then 'we have data, user exists


success = True
End If
While theReader.Read
authorityReader = theReader(2)
End While
ProgrammingRe: Multiple Login Control by ABAboi(op): 2:03pm On Nov 23, 2009
webdezzi:
u can either create the 2 forms, do some checks based on a preset privilege, then display the right form
or show/hide widgets if the differences in both forms are not much


but really, if u have issues with managing previleges, only God knows,
Thanks for your input. Those checks based on a preset privilege is what i want to know. I thought about creating a column called Authority in the table, then assigning them with number eg gardener =1, Manager = 2, But i need other ideas on how to make it work better
ProgrammingRe: Multiple Login Control by ABAboi(op): 12:37pm On Nov 23, 2009
Paroh_frey:
is the staffid not unique to each person, what else do you want to use to differentiate?
I am able to authenticate all the staff ID thats not the issue. For instance, i need to show form1 if the gardener is logged in, form2 if manager is logged etc.

Beaf:
Use ASP.Net Membership, it contains all the classes you need for a role based authentication system. It is a synch to use, why re-invent the wheel?
Google ASP.Net Membership.

For windows forms http://www.theproblemsolver.nl/usingthemembershipproviderinwinforms.htm
The code was quite helpful thanks. But i am using VB not ASP as the program is not web based.
ProgrammingMultiple Login Control by ABAboi(op): 11:28pm On Nov 22, 2009
Hello guys, am working on a staff management program(using VB.NET and SQLSERVER) that requires workers with different authorities to access the system. For Instance, a gardener and Manager will log in to the system using a unique staff ID. What is your idea on how to differentiate between the users when they log in??

ProgrammingRe: Vb.net Code To Display Image In Picturebox From Sql Server by ABAboi: 11:03pm On Nov 22, 2009
Its actually a straight forward process. Follow the following steps. However the following codes basically scans ur computer for .JPEG file extensions and adds them direct to ur SQLSERVER. But ofcourse u can decide to import the image in a picture box control prior saving it in the database.
Create a table named "ImageData"Its attributess are

Name (varChar50)
Picture  (Image)
CreateDate(varChar20)--'NOT REALLY NECCESSARY

Now in your Form,
You will need  2 buttons named btnSave and BtnSearch, textbox (txtName)

For the clicked event of btnSearch, add these codes
Dim pictureLocation As String
        Dim a As New OpenFileDialog
        a.Filter = ("Image files| *.JPG"wink
        pictureLocation = a.FileName
       
            a.ShowDialog()
            Using conn As New System.Data.SqlClient.SqlConnection("[s]Data Source=DENSMAN-PC\SQLEXPRESS;Initial Catalog=aba;Integrated Security=True[/s]"wink 'Insert ur connection string here
                conn.Open()

                Using cmd As New SqlClient.SqlCommand("Insert Into ImageData(Name, CreateDate, Picture) Values (@Name, @CreateDate, @Picture)", conn)
                    cmd.Parameters.Add(New SqlClient.SqlParameter("@Name", SqlDbType.VarChar)).Value = txtName.Text
                    cmd.Parameters.Add(New SqlClient.SqlParameter("@CreateDate", SqlDbType.VarChar)).Value = DateTime.Today
                    cmd.Parameters.Add(New SqlClient.SqlParameter("@Picture", SqlDbType.Image)).Value = IO.File.ReadAllBytes(a.FileName)
                    cmd.ExecuteNonQuery()
                End Using


            End Using
       
When you are done with the following, i can tell u other ways to modify and optimise your programme, then i will give u the second part once u get this working. Cheers
CareerList 10 Most Needed Information Technology Needs Of Nigeria by ABAboi(op): 8:50pm On May 18, 2009
Hello guys, I am new here and love the great and quality interaction going on here. Please i am a Nigerian IT software developer based in UK, i want to develop programmes(softwares) that is  not readily available in Nigeria.
Please i would like you to help me list the most needed IT programmes in Nigeria. The one's i have in mind includes;
1. Motor vehicle reg system and mgt for FRSC (federal road safety corps)
2. Mobile banking
3. Computerised birth registration system
4. Transportation tracking system (to manage time and duration of buses in cities)

Please i need your opinion thanks

1 2 3 4 (of 4 pages)