首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

vb.net里面出现不支持data source关键字,该怎么解决

2012-03-21 
vb.net里面出现不支持data source关键字Imports System.DataImports System.Data.SqlClientPublic Class F

vb.net里面出现不支持data source关键字
Imports System.Data
Imports System.Data.SqlClient

Public Class Form1
  Shared link As String = "data sourse=.;initial catalog=telephone;integrated security=true"
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  Dim linking As New SqlConnection
  linking.ConnectionString = link
  Dim mycommand As SqlCommand = linking.CreateCommand
  mycommand.CommandText = "insert into load(phone)value(@phone)"
  mycommand.Parameters.Add("@phone", SqlDbType.Int, 4)
  If Val(txtphone.Text) < 11111111 Or Val(txtphone.Text) > 99999999 Then
  MsgBox("没有此号码!")
  txtphone.Clear()

  End If
  mycommand.Parameters("@phone").Value = Val(txtphone.Text)
  linking.Open()
  mycommand.ExecuteNonQuery()
  linking.Close()
  Me.Close()
  Form2.Show()



  End Sub
End Class
调试的时候老说不支持data source 关键字

[解决办法]

VB.NET code
Shared link As String = "data [color=#FF0000]sourse[/color]=.;initial catalog=telephone;integrated security=true" 

热点排行