Click here to Skip to main content
15,921,622 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: displaying images from database using image url Pin
Richard MacCutchan7-Sep-09 5:21
mveRichard MacCutchan7-Sep-09 5:21 
QuestionVB.Net 2005 - Displaying Forms In LandScape format - Sourabh Das - Urgent Pin
Dot Net Jantu4-Sep-09 22:11
Dot Net Jantu4-Sep-09 22:11 
AnswerRe: VB.Net 2005 - Displaying Forms In LandScape format - Sourabh Das - Urgent Pin
Richard MacCutchan4-Sep-09 23:28
mveRichard MacCutchan4-Sep-09 23:28 
GeneralRe: VB.Net 2005 - Displaying Forms In LandScape format - Sourabh Das - Urgent Pin
Dot Net Jantu5-Sep-09 0:47
Dot Net Jantu5-Sep-09 0:47 
GeneralRe: VB.Net 2005 - Displaying Forms In LandScape format - Sourabh Das - Urgent Pin
Richard MacCutchan5-Sep-09 3:43
mveRichard MacCutchan5-Sep-09 3:43 
Questioni want to play that movie client computer.but i don't know how to play those incoming bytes runtime. Pin
aemindia_r4-Sep-09 19:46
aemindia_r4-Sep-09 19:46 
Questionstore date to database Pin
mahendravarman n3-Sep-09 15:12
mahendravarman n3-Sep-09 15:12 
AnswerRe: store date to database Pin
Aman Bhullar3-Sep-09 19:17
Aman Bhullar3-Sep-09 19:17 
Create a database named Emp in Microsoft Access in the C: drive of your machine. In the Emp database create a table, Table1 with EmpNo, EName and Department as columns, insert some values in the table and close it. Open Visual Studio .NET, on a new form drag three TextBoxes and a Button. The following code will assume that TextBox1 is for EmpNo, TextBox2 is for EName and TextBox3 is for Department. Our intention is to retrieve data from Table1 in the Emp Database and display the values in these TextBoxes without binding when the Button is clicked.

Code for retrieving records
Imports System.Data.OleDb
Public Class Form1 Inherits System.Windows.Forms.Form
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e as _
System.EventArgs) Handles MyBase.Load
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles Button1.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;_
Data Source=C:\emp.mdb;")
'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select * from table1", cn)
dr = cmd.ExecuteReader
While dr.Read()
TextBox1.Text = dr(0)
TextBox2.Text = dr(1)
TextBox3.Text = dr(2)
' loading data into TextBoxes by column index
End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
End Class 


Code for Inserting a Record
Imports System.Data.OleDb
Public Class Form2 Inherits System.Windows.Forms.Form
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Dim icount As Integer
Dim str As String

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles Button2.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\emp.mdb;")
cn.Open()
str = "insert into table1 values(" & CInt(TextBox1.Text) & ",'" & TextBox2.Text & "','" &_
TextBox3.Text & "')"
'string stores the command and CInt is used to convert number to string
cmd = New OleDbCommand(str, cn)
icount = cmd.ExecuteNonQuery
MessageBox.Show(icount)
'displays number of records inserted
Catch
End Try
cn.Close()
End Sub
End Class 


You can refer the complete article from
http://www.startvbdotnet.com/ado/msaccess.aspx[^]

For detailed study, study OleDb data Provider

Regards
Aman Bhullar
www.arlivesupport.com[^]

QuestionWake Up PDA with CeRunAppAtTime Pin
Simon Ashford2-Sep-09 10:33
Simon Ashford2-Sep-09 10:33 
QuestionRegexp for date? Pin
Michael Pauli2-Sep-09 9:34
Michael Pauli2-Sep-09 9:34 
AnswerRe: Regexp for date? Pin
Michael Pauli2-Sep-09 9:46
Michael Pauli2-Sep-09 9:46 
AnswerRe: Regexp for date? Pin
annathor2-Sep-09 20:39
annathor2-Sep-09 20:39 
GeneralRe: Regexp for date? Pin
Michael Pauli2-Sep-09 21:00
Michael Pauli2-Sep-09 21:00 
AnswerRe: Regexp for date? Pin
Gideon Engelberth3-Sep-09 2:51
Gideon Engelberth3-Sep-09 2:51 
GeneralRe: Regexp for date? Pin
Michael Pauli3-Sep-09 3:32
Michael Pauli3-Sep-09 3:32 
AnswerRe: Regexp for date? Pin
Pete O'Hanlon3-Sep-09 4:23
mvePete O'Hanlon3-Sep-09 4:23 
Questionconnection string error Pin
vishal lele2-Sep-09 1:54
vishal lele2-Sep-09 1:54 
AnswerRe: connection string error Pin
Eddy Vluggen2-Sep-09 3:21
professionalEddy Vluggen2-Sep-09 3:21 
QuestionCannot start a .NET assembly after password change Pin
A. Delcroix2-Sep-09 1:27
A. Delcroix2-Sep-09 1:27 
QuestionError 1053: The service did not respond to the start or control request in a timely fashion. Pin
khayyam221-Sep-09 20:25
khayyam221-Sep-09 20:25 
AnswerRe: Error 1053: The service did not respond to the start or control request in a timely fashion. Pin
Aman Bhullar1-Sep-09 20:31
Aman Bhullar1-Sep-09 20:31 
GeneralRe: Error 1053: The service did not respond to the start or control request in a timely fashion. Pin
khayyam221-Sep-09 20:35
khayyam221-Sep-09 20:35 
GeneralRe: Error 1053: The service did not respond to the start or control request in a timely fashion. Pin
khayyam221-Sep-09 21:11
khayyam221-Sep-09 21:11 
GeneralRe: Error 1053: The service did not respond to the start or control request in a timely fashion. Pin
khayyam221-Sep-09 21:12
khayyam221-Sep-09 21:12 
Questionchange label text at runtime Pin
rashid20091-Sep-09 19:55
rashid20091-Sep-09 19:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.