Jump to content
Sign in to follow this  
sager

Cemana ndak buat table kat database dr VB.NET?

Recommended Posts

Assalamm....saya ndak bukak table baru dlm database menggunakan VB.NET dan ODBC.tetapi buat masa ni code dia x work.So, sy mintak panduan dan nasihat drpd user yg berpengalaman semua utk menambah baik code saya ini.Saya tertannya kenapa x nampak table baru dalam database postgresql?


Imports System
Imports System.Data
Imports System.Data.Odbc



Public Class Form1

Dim thisConnection As New OdbcConnection _
("dsn=MyOdbc")
Dim nonqueryCommand As OdbcCommand = thisConnection.CreateCommand()

Public sConnection As String = "DSN=PostgreSQL30;UID=tele;PWD=tiny;"
Public cnDB As New Odbc.OdbcConnection(sConnection)

Public dsDB As New DataSet
Public adDB As New Odbc.OdbcDataAdapter


Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
nonqueryCommand.CommandText = "CREATE TABLE mytable " & _
"(MyName VARCHAR (30), MyNumber INTEGER)"
'Console.WriteLine("Executing {0}", _
' nonqueryCommand.CommandText)
'Console.WriteLine("Number of rows affected : {0}", _
' nonqueryCommand.ExecuteNonQuery())
Try
cnDB.Open()
'adDB.SelectCommand = New Odbc.OdbcCommand(" CREATE TABLE sensor_result_test ")

MsgBox("Connect to Database", MsgBoxStyle.Information, "Success")
cnDB.Close()
Catch ex As Exception
MsgBox("Connection to database Failed", MsgBoxStyle.Critical, "Action Failed")
End Try


End Sub

End Class



fail dia.

http://rapidshare.com/files/268975860/BuiltNewtables1.rar.html


sekian terima kasih.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...