I have a problem in compiling this code sqlException was unhandled Invalid object name dd_tb
Please can you help me to find the problem
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Inherits System.Windows.Forms.Form
Dim cn As SqlConnection
Dim ds As DataSet
Dim da As SqlDataAdapter
Dim r As DataRow
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strconnection As String = "data source=localhost;initial catalog=master;integrated security=true"
cn = New SqlConnection(strconnection)
cn.Open()
Try
cn.ChangeDatabase("dd_db")
Catch ex As Exception
Try
Dim command As New SqlClient.SqlCommand("create database dd_db", cn)
command.ExecuteNonQuery()
command.Connection.ChangeDatabase("dd_db")
Dim command1 As New SqlClient.SqlCommand("create table dd_tb ([admi.num][int](10),[tran.num][int](4),[name][char](40),[age.reci][int](2),[sex.reci][char](8),[or.kid.d][char](22),[specify][char](50),[consang][char](20),[rec.b.g][char](8),[r_iggt][char](8),[r_iggr][char](12),[r_igmt][char](8),[r_igmr][char](12),[r_hcvt][char](8),[r_hcvr][char](12),[r_pcrt][char](8),[r_pcrr][char](12),[r_hbvt][char](8),[r_hbvr][char](12),[r_bpcrt][char](8),[r_bpcrr][char](12),[blood.gp][char](10),[rhla_aa][int](8),[rhla_ab][int](8),[rhla_ba][int](8),[rhla_bb][int](8),[rdr_a][int](8),[rdr_b][int](8),[prior.bl][char](8),[type.blo][char](15),[number.o][char](15),[num.bl.t][int](2),[datel.bl][date](10),[erythrop][char](8),[hypr_pre][char](8),[rec_schi][char](8),dia_rec][char](22),[sit_urn][char](12),[dial_pre][char](8))", cn)
command1.ExecuteNonQuery()
Catch ex1 As Exception
MsgBox(ex.Message)
End Try
End Try
da = New SqlDataAdapter("select * from dd_tb", cn)
Dim x As New SqlCommandBuilder(da)
ds = New DataSet()
da.Fill(ds, "dd_tb")
End Sub
[Edit]Code block added[/Edit]