473,394 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to add picture on vb-access? how to save? how to retrieve?

Dear sir,

i am a student,i do one sample project in vb.6 and access 2003.i designed one form for students entry,name and address, etc,this details are saved in database and retrive in my choice.
but i have plan to insert student pictrue in my 'students entry form'.i have no idea about this picture insertation.can u please help me, how to insert pictrue,how to stored in database,how to retrive photo on my search command.

i also attached my source code,module source code and screen shot of form.

yours faithfully
boby kuriakose



----------------------------------SOURCE CODE ENTRY FORM---------------------------------

Expand|Select|Wrap|Line Numbers
  1. Dim rs As New ADODB.Recordset
  2. Dim rs1 As New ADODB.Recordset
  3. Dim rs2 As New ADODB.Recordset
  4. Dim rs3 As New ADODB.Recordset
  5. Dim rs4 As New ADODB.Recordset
  6. Dim rs5 As New ADODB.Recordset
  7. Dim i As Integer
  8. Dim sngDailyRate As Single
  9. Dim sngNumberOfDays As Integer
  10. Dim sngHireCost As Single
  11.  
  12. Dim strLastName As String * 20
  13. Dim strFirstName As String * 20
  14. Dim s As String
  15. Dim sql As String
  16.  
  17. Private Sub cmdadd_Click()
  18.  cmddelete.Enabled = False
  19. cmdadd.Enabled = True
  20. cmdedit.Enabled = False
  21. cmdsave.Enabled = True
  22. cmdsearch.Enabled = True
  23.  txtregno.Text = ""
  24.  
  25. End Sub
  26.  
  27. Private Sub cmddelete_Click()
  28.  
  29. If rs3.State Then
  30.    rs3.Close
  31. End If
  32.  
  33.  sql = "delete  from studentdetails where regno=" & Int(txtregno.Text) & ""
  34.  rs3.Open sql, cn, adOpenKeyset, adLockOptimistic
  35. txtregno.Text = ""
  36.  
  37.      DTPlearfrom.Enabled = False
  38.      DTPlearto.Enabled = False
  39.      MsgBox "DATA SUCCESS TO DELETE"
  40. End Sub
  41.  
  42. Private Sub cmdedit_Click()
  43. cmddelete.Enabled = False
  44. cmdadd.Enabled = True
  45. cmdedit.Enabled = False
  46. cmdsave.Enabled = True
  47. cmdsearch.Enabled = True
  48. txtregno.Enabled = True
  49.  
  50. End Sub
  51.  
  52. Private Sub cmdsave_Click()
  53. If rs4.State Then
  54.    rs4.Close
  55. End If
  56.  
  57.  sql = "delete  from studentdetails where regno=" & Int(txtregno.Text) & ""
  58.  rs4.Open sql, cn, adOpenKeyset, adLockOptimistic
  59.  
  60. If rs.State Then
  61.    rs.Close
  62. End If
  63.  
  64.  sql = "select * from studentdetails where regno=" & 0 & ""
  65.  rs.Open sql, cn, adOpenKeyset, adLockOptimistic
  66.    If rs.RecordCount = 0 Then
  67.    With rs
  68.  
  69. .AddNew
  70.     !RegNo = txtregno.Text
  71.  
  72.     End If
  73.  
  74.     MsgBox "DATA SUCCESS TO SAVE"
  75.  
  76.     .Update
  77.     End With
  78. End If
  79. txtregno.Text = ""
  80.   txtlearnearsno.Text = ""
  81.  
  82. End Sub
  83.  
  84. Private Sub cmdsearch_Click()
  85.  MSFlexGrid1.Rows = 1
  86. MSFlexGrid1.Visible = True
  87. If rs5.State Then
  88.    rs5.Close
  89. End If
  90.  
  91. i = 1
  92. MSFlexGrid1.TextMatrix(0, 0) = "RegNo"
  93.          MSFlexGrid1.TextMatrix(0, 1) = "NAME"
  94. If Optname.Value = True Then
  95. sql = "select * from studentdetails where name like '" & "%" & Trim(txtsrchname.Text) & "%" & "'"
  96.  rs5.Open sql, cn, adOpenKeyset, adLockOptimistic
  97.    While Not rs5.EOF
  98.         MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
  99.          MSFlexGrid1.TextMatrix(i, 0) = rs5.Fields!RegNo
  100.          MSFlexGrid1.TextMatrix(i, 1) = rs5.Fields!Name
  101.  
  102.          rs5.MoveNext
  103.         i = i + 1
  104.  
  105.         Wend
  106.   End If
  107. End Sub
  108.  
  109. Private Sub Form_Load()
  110. Optname.Value = True
  111. txtsrchname.Enabled = True
  112. cmddelete.Enabled = False
  113. cmdadd.Enabled = True
  114. cmdedit.Enabled = False
  115. cmdsave.Enabled = False
  116. cmdsearch.Enabled = True
  117. MSFlexGrid1.ColWidth(0) = 0
  118. MSFlexGrid1.Visible = False
  119.  
  120.  
  121.  
  122. End Sub
  123.  
  124.  
  125.  
  126. Private Sub MSFlexGrid1_DblClick()
  127. Frame3.Visible = False
  128. cmdedit.Enabled = True
  129. cmddelete.Enabled = True
  130. cmdadd.Enabled = True
  131. cmdsave.Enabled = False
  132. cmdsearch.Enabled = True
  133. MSFlexGrid1.Visible = False
  134. If rs2.State Then
  135.    rs2.Close
  136. End If
  137.  
  138.  sql = "select * from studentdetails where regno=" & Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)) & ""
  139.  rs2.Open sql, cn, adOpenKeyset, adLockOptimistic
  140.    If rs2.RecordCount > 0 Then
  141.    With rs2
  142.  
  143.  
  144.    txtregno.Text = .Fields!RegNo
  145.  
  146.  
  147.  
  148.  
  149.     End With
  150. End If
  151. txtregno.Enabled = False
  152.  
  153. End Sub
  154.  
  155.  
  156. --------------------MODULE SOURCE CODE------------
  157.  
  158. Option Explicit
  159. Global cn As New Connection
  160. Public Sub open_connection()
  161. End Sub
  162.  
  163. Public Sub Main()
  164. If cn.State Then cn.Close
  165. cn.Open "microfox", "t", "a26yo1a01i0oo8Qr5ty51w521bipa"
  166. frmSplash.Show
  167. End Sub
Attached Files
File Type: doc VB.doc (41.0 KB, 289 views)
Jun 7 '13 #1
0 1253

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Timin Uram | last post by:
Can someone tell me how to write php code to save an image from the internet to the server? For example, if there was a picture at http://somepage.com/hello.jpg I want to write a php script that...
6
by: charsh | last post by:
Hi, I using the code below to draw a text in a pictureBox1. //Start--------------------------------------------------------------- private void button1_Click(object sender, System.EventArgs e)...
1
by: Sam Jost | last post by:
Bitmap.Save() does crash very often on Saving jpg's. It seems to dislike pictures on a random basis, but when it dislikes a picture there is no way around it. Take for example the picture...
1
by: john woo | last post by:
Hi I'm not sure it's possible that using javascript to locate/get components X|Y then other language, like java-jsp to save/retrive these data. For instance, a GUI presents a layout of...
2
by: 1388-2/HB | last post by:
I've got a small sockets application where I communicate with a web server via async sockets method. Using the ASCIIEncoding Class, I convert strings to byte arrays (and vice versa) in...
0
by: Filippo Bettinaglio | last post by:
Hi, C# 2005 I load a 24bit BMP image in a picture box, what i need to do is save a 8bits(256 color) of that image. How can i do it? Many Thanks, Filippo
0
by: Chetana | last post by:
Hi , I want the asp.net code to upload the video file ,save it in sql server and display it after retriving it . Please let me know immidiately . Thanks
5
by: hareldo | last post by:
hi, i wrote a code that open a picture and store it in a string. then its save the base_64 of this string in a jpeg file and then i can show this picture. but i want to show this picture without...
2
by: manjunadha | last post by:
I want the asp.net code to upload the video file ,save it in sql server and display it after retriving it .plzzzz send me reply........very urgent for me. Thnaks in Advance.. Regards,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.