Ok. I got a really helpful reply from a member. How do I make sure that he gets the 'green' against his name?
Ok. I got a really helpful reply from a member. How do I make sure that he gets the 'green' against his name?
In the 'Latest Reputation Received' thingy, the icon next to the thread name sometimes shows a green and gray/black sometimes. What is that supposed to mean?
Hi!
I am tuse from India.
I am doing my engineering in Computers.
Working with VB.NET and ASP at present, see you in the forums!
Well the number of rows really do not matter.
In the code that I have posted below, I hold the number of rows in a variable named total.
I have chosen to extract the contents of the first column, if you want to do so for the column number x, substitute 0 by x-1 in the statement below in the code-
a(i) = ds.Tables("trial1").Rows(i).Item(0)
I am adding the contents retrieved to a ListBox, just as a check.
Public Class Form1
Dim a() As String
Dim total As Integer
Dim cn As New Odbc.OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=shreyas; User=root;Password=;")
Dim cmd As Odbc.OdbcCommand
Dim adp As Odbc.OdbcDataAdapter
Dim ds As New DataSet
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cn.Open()
cmd = New Odbc.OdbcCommand("Select * from trial1", cn)
adp = New Odbc.OdbcDataAdapter(cmd)
adp.Fill(ds, "trial1")
'Count the number of rows
total = ds.Tables("trial1").Rows.Count - 1
Dim i As Integer
ReDim a(0 To total)
For i = 0 To total
a(i) = ds.Tables("trial1").Rows(i).Item(0)
Next
Dim j As Integer
For j = 0 To total
Me.ListBox1.Items.Add(a(j))
Next
End Sub
End Class
Agree. Its something like the getch used in Turbo C
The output is shown but the window closes before you can see it
button 1 is the update button.
let me know if this helped you.
You should use a Command Builder to update records so that changes made to the dataset can be reflected into the database. Here is some sample code-
Public Class Form1
Dim cn As New Odbc.OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=shreyas; User=root;Password=;")
Dim cmd As Odbc.OdbcCommand
Dim adp As Odbc.OdbcDataAdapter
Dim ds As New DataSet
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
cn.Close()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Fill the data grid viewer
cn.Open()
cmd = New Odbc.OdbcCommand("Select * from trial1", cn)
adp = New Odbc.OdbcDataAdapter(cmd)
adp.Fill(ds, "trial1")
Me.DataGridView1.DataSource = ds
Me.DataGridView1.DataMember = "trial1"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Update records using a Command Builder
' The variable i gives the number of records updated
Dim cmdbuilder As New Odbc.OdbcCommandBuilder(adp)
Dim i As Integer
Try
i = adp.Update(ds, "trial1")
MsgBox("Records Updated= " & i)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
let us say you have a login button on the registration form which gets enabled on validation of registration details.
code for login button- form2.showdialog()
in the form_load for the 2nd form, do form1.hide()
and in the form closing event for the 2nd form, remember to do form1.close()
Is there is query with which I can get the sum of elements in one row?
I am trying to develop an atttendance application. Design as follows-
<date1> <date2> <date3> <date4>--- <attended>
<rollno1> 1 0 1 1 3
<rollno2> 0 0 1 1 2
<rollno3> 0 1 0 0 1
I am trying to get the attended field.
Is it possible, or is it a bad design?
Please suggest an alternate design if so.
I am absolutely new to database design.
I think it is a better option to use a binding source to solve your problem.
You can attach data to a component using the following-
dim ds as new dataset
dim bs as new bindingsource(ds,"<table name>")
me.textbox1.databindings.add("Text",bs,"<field name>")
Next button- bs.Movenext()
Previous- bs.MovePrevious()
Is there any way in which a crystal report be generated by giving the table name at runtime?
ie. the user chooses the table whose report is needed and the .rpt files do not exist beforehand.
I am new to VB. Yesterday I learnt how to connect to a database. My work computer has Microsoft SQL Server (which I could connect to) but I use mySQL at home and do not know how to connect to it.
Can somebody please help?
Ok great it works.
Thanks for your help.
Indeed before posting I did do so.
None of the links seem to be working.
The one downloaded from pypi.python.org/pypi is a .egg file.
How are you supposed to handle this extension?
I am an absolute beginner to python.
I would like to know how to download and install the modules.
I am working on Windows.
I am specifically looking to use the 'gasp' module.
Any help would be highly appreciated.