TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mfwamba Tshimanga
NA
155
46k
why this message??? But every thing sound correct!
Jul 3 2014 9:17 PM
Hi!
I wrote these codes to make filter from my textbox.... At the same time we can observ records be filtered inside of the datagrid. unfortunatly I receive this message
Cannot implicitly convert type 'System.Data.CommandType' to 'string'
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
SqlConnection con = new SqlConnection(@"Data Source=localhost\\sqlexpress;Initial Catalog=master;Integrated Security=True");
public Form1()
{
InitializeComponent();
}
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandText =
CommandType.Text;
// the bug it's here
cmd.CommandText = "select * from consultoria where produto like ('"+textBox1.Text+"%')";
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
con.Close();
dataGridView1.DataSource = dt;
}
}
}
Reply
Answers (
3
)
Reportviewer on one textbox
ASP.NET calender