Click here to Skip to main content
16,005,697 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionProblem clearing process ... Pin
Rashar11-Jul-06 5:19
Rashar11-Jul-06 5:19 
AnswerRe: Problem clearing process ... Pin
Dave Kreskowiak11-Jul-06 9:19
mveDave Kreskowiak11-Jul-06 9:19 
QuestionSelecting the TreeNode Pin
MAP Tiger11-Jul-06 5:18
MAP Tiger11-Jul-06 5:18 
QuestionVBA macro selection with word Pin
Waldermort11-Jul-06 4:01
Waldermort11-Jul-06 4:01 
Questionstored procedure Pin
vidyashankar11-Jul-06 1:54
vidyashankar11-Jul-06 1:54 
AnswerRe: stored procedure Pin
Dave Sexton11-Jul-06 2:15
Dave Sexton11-Jul-06 2:15 
AnswerRe: stored procedure Pin
Christian Graus11-Jul-06 4:11
protectorChristian Graus11-Jul-06 4:11 
Questioncreate table command from listview Pin
newbjohny11-Jul-06 0:51
newbjohny11-Jul-06 0:51 
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
AnswerRe: create table command from listview [modified] Pin
fredde_d12-Jul-06 4:04
fredde_d12-Jul-06 4:04 
GeneralRe: create table command from listview Pin
newbjohny12-Jul-06 4:37
newbjohny12-Jul-06 4:37 
Questionhow to run vb script for setup & deployment wizard Pin
Member 227165511-Jul-06 0:05
Member 227165511-Jul-06 0:05 
QuestionCrystel Report Style Pin
paragyerawar11-Jul-06 0:02
paragyerawar11-Jul-06 0:02 
AnswerRe: Crystel Report Style Pin
PapPatel13-Jul-06 8:40
PapPatel13-Jul-06 8:40 
QuestionOutLook in vb.net Pin
microuser_200010-Jul-06 23:48
microuser_200010-Jul-06 23:48 
AnswerRe: OutLook in vb.net Pin
KreativeKai14-Jul-06 2:05
professionalKreativeKai14-Jul-06 2:05 
QuestionHow to replace null(00) character instead of space(20)? Pin
eddie.jiang.tw10-Jul-06 23:36
eddie.jiang.tw10-Jul-06 23:36 
AnswerRe: How to replace null(00) character instead of space(20)? Pin
Guffa10-Jul-06 23:47
Guffa10-Jul-06 23:47 
GeneralRe: How to replace null(00) character instead of space(20)? Pin
Christian Graus11-Jul-06 1:21
protectorChristian Graus11-Jul-06 1:21 
GeneralRe: How to replace null(00) character instead of space(20)? Pin
eddie.jiang.tw11-Jul-06 22:40
eddie.jiang.tw11-Jul-06 22:40 
Questionthis is how u have to create ODBC , DSN using vb script Pin
Member 227165510-Jul-06 22:34
Member 227165510-Jul-06 22:34 
QuestionExport to WOrd Pin
Socheat.Net10-Jul-06 22:02
Socheat.Net10-Jul-06 22:02 
AnswerRe: Export to WOrd Pin
Member 227165511-Jul-06 1:02
Member 227165511-Jul-06 1:02 
QuestionRichTextBox Pin
Socheat.Net10-Jul-06 22:00
Socheat.Net10-Jul-06 22:00 
Questionword document in web application Pin
Manik Nath10-Jul-06 20:42
Manik Nath10-Jul-06 20:42 
AnswerRe: word document in web application Pin
Rizwan Bashir10-Jul-06 22:52
Rizwan Bashir10-Jul-06 22:52 

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.