Hi, thanks for your speedy reply,

Yes, you have understood my code correctly, this is the create table
statement, and at the time of execution all column names are known to the
form, I am just unsure as how to get them from the listview to place into a
create table statement, I think I will need some sort of FOR loop to bring
back each line that is in the listview but I am unsure as how to do this.
This is my first time working with listviews and I've searched the internet
and have 7 books from the library on vb.net but none explain how to get
details from a listview, only how to populate it.

I think I worded my original message wrong.

Do you know of a way I could get the details from the listview?

Many thanks for your help

John

On 11/07/06, C.Peachment <[EMAIL PROTECTED]> wrote:

If  understand your code correctly, this line creates a table with a
single column.

        dbConn.createTable("CREATE TABLE " & tblName & "(" & fldName & " "
&
        fldAttribute & ")")

You describe a user interface to be used to create tables with multiple
columns.

You must do one of two things:

        1. delay the create table statement execution until all columns
are
        known and can be included inside the parentheses, or

        2. perform the create for the first column and then use the alter
table
        statement to append remaining columns, perhaps one at a time.

-----------

On Tue, 11 Jul 2006 10:57:36 +0100, John Newby wrote:

>Hi, I am creating a front-end to the sqlite DBMS using VB.Net 2002. I
have
>managed to get the name of the table, field names and types from user
input
>displayed into a listview but I can only get the Create table command to
>accept the last input values, so if the table has more than one
field(which
>nealry every table has) it simply ignores the previously entered fields.

>How would I get it to create an SQL query with all the inputted field
>details?

>I have inserted the code I have used so far.

>Many thanks for your help.

>This button opens up a new form for the user to input the field name and
>select the field type then brings them back and displays them in a
listview.


>Public Sub btnAddColumn_Click(ByVal sender As System.Object, ByVal e As
>System.EventArgs) Handles btnAddColumn.Click
>Dim frmAddColumns1 As New frmAddColumns()
>frmAddColumns1.ShowDialog(Me)
>fldName = frmAddColumns.ColumnNameTB.Text
>fldAttribute = frmAddColumns.ColumnTypeTB.SelectedItem
>'Create ListViewItem
>Dim item1 As New ListViewItem(fldName, 0)
>item1.SubItems.Add(fldAttribute)
>'Add the items to the ListView.
>listView1.Items.AddRange(New ListViewItem() {item1})
>Me.Controls.Add(listView1)
>End Sub

>This button takes the input table name, field name and attributes and
>creates the SQL command to send to the database to create the table:


>Private Sub btnCreateTable_Click(ByVal sender As System.Object, ByVal e
As
>System.EventArgs) Handles btnCreateTable.Click
>Dim tblName As String
>tblName = txtTableName.Text.ToString()
>If Len(txtTableName.Text) < 1 Then
>MessageBox.Show("Please type a name for the table")
>ElseIf Len(txtTableName.Text) > 0 Then
>Try
>dbConn.openExistingDatabse("Data Source=" & getDBName() &
>";Version=3;New=False;Compress=True;")
>dbConn.createSQLCommand()
>dbConn.createTable("CREATE TABLE " & tblName & "(" & fldName & " " &
>fldAttribute & ")")
>MessageBox.Show("Table created successfully")
>Me.Close()
>Dim frmInsertData1 As frmInsertData = New frmInsertData()
>frmInsertData1.Show()
>Catch es As Exception
>MessageBox.Show(es.Message)
>End Try
>End If
>End Sub





Reply via email to