Dim ddi As String = Date.Today
Dim Mycon As String = ("C:\Users\Bruno Soares\Documents\Visual Studio 2012\Projects\Projecto Castramento\Projecto Ca\Database1.sdf")
Dim csvconnectionstring As String = My.Computer.FileSystem.CurrentDirectory & "Database1.sdf"
Using cn As New SqlConnection(Mycon)
cn.Open()
Using cmd As New SqlCommand("INSERT INTO Cliente(Nome, Endereço, Complemento, Número, Bairro, CEP, DDi, DDn, Sexo, Telefone, Celular, Email, Visitas) VALUES('" & nome.Text & "','" & endereço.Text & "','" & complemento.Text & "','" & numero.Text & "','" & bairro.Text & "', #" & cep.Text & "#, " & ddi & "," & niver.Text & "," & sexo.SelectedItem & telefone.Text & celular.Text & email.Text & 0 & ")", cn)
Try
With cmd
.Connection = cn
.CommandType = CommandType.StoredProcedure
.Parameters.Add("@Nome", SqlDbType.Int, 4)
.Parameters("@Nome").Value = nome.Text
End With
Catch ex As Exception
End Try
cn.Close()
End Using
End Using
System.ArgumentException was unhandled
HResult=-2147024809
Message=O formato da cadeia de inicialização não está de acordo com a especificação iniciada no índice 0.
Source=System.Data
StackTrace:
em System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue)
em System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)
em System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules)
em System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
em System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
em System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
em System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)
em System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
em System.Data.SqlClient.SqlConnection..ctor(String connectionString, SqlCredential credential)
em System.Data.SqlClient.SqlConnection..ctor(String connectionString)
em Projecto_cadastro_de_gente_fina.Cadastro.Button1_Click(Object sender, EventArgs e) na C:\Users\Bruno Soares\Documents\Visual Studio 2012\Projects\Projecto Castramento\Projecto Castramento\Cadastro.vb:linha 11
em System.Windows.Forms.Control.OnClick(EventArgs e)
em System.Windows.Forms.Button.OnClick(EventArgs e)
em System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
em System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
em System.Windows.Forms.Control.WndProc(Message& m)
em System.Windows.Forms.ButtonBase.WndProc(Message& m)
em System.Windows.Forms.Button.WndProc(Message& m)
em System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
em System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
em System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
em System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
em System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
em System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
em System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
em System.Windows.Forms.Application.Run(ApplicationContext context)
em Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
em Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
em Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
em Projecto_cadastro_de_gente_fina.My.MyApplication.Main(String[] Args) na 17d14f5c-a337-4978-8281-53493378c1071.vb:linha 81
em System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
em System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
em System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
em Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
em System.Threading.ThreadHelper.ThreadStart_Context(Object state)
em System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
em System.Threading.ThreadHelper.ThreadStart()
InnerException:
Hello!
The code outlined above is causing an exception Handled