command.Parameters.AddWithValue("@number", TextBox1.Text)
can i do this from another way?
Jump to PostNot sure what you are asking? Why can't you use this method?
Not sure what you are asking? Why can't you use this method?
when i try to search something, program give me this error; Must declare the variable [EMAIL="'@number'"]'@number'[/EMAIL] on this line; DataGridView2.DataMember = "mutsuz".
full code is this.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim baglanti As New SqlClient.SqlConnection()
Dim dataadapter As SqlClient.SqlDataAdapter
Dim command As New SqlClient.SqlCommand
Dim dataset As New DataSet
baglanti.ConnectionString = "data source=zengin\instance2000;" & "initial catalog=inandbf;" & "integrated security= SSPI"
baglanti.Open()
command = baglanti.CreateCommand
command.CommandText = "select number, name, surname from veriler where number=@number"
command.Parameters.AddWithValue("@number", TextBox1.Text)
dataadapter = New SqlClient.SqlDataAdapter(command.CommandText, baglanti)
dataadapter.Fill(dataset, "mutsuz")
DataGridView2.DataSource = dataset
DataGridView2.DataMember = "mutsuz"
baglanti.Close()
End Sub
sorry, error comes on this line dataadapter.Fill(dataset, "mutsuz")
Try the following intead of
command.Parameters.AddWithValue("@number", TextBox1.Text)
dataadapter.SelectCommand.Parameters.AddWithValue("@number", TextBox1.Text).
Sampiyon FeNeRbAhCe
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.