Click here to Skip to main content
15,887,383 members
Home / Discussions / Database
   

Database

 
QuestionForce DTS Failure Pin
Bjohnson3317-Oct-07 0:33
Bjohnson3317-Oct-07 0:33 
AnswerRe: Force DTS Failure Pin
andyharman17-Oct-07 1:53
professionalandyharman17-Oct-07 1:53 
GeneralRe: Force DTS Failure Pin
Bjohnson3317-Oct-07 2:57
Bjohnson3317-Oct-07 2:57 
QuestionCreate Function Pin
Sarfaraj Ahmed16-Oct-07 23:34
Sarfaraj Ahmed16-Oct-07 23:34 
AnswerRe: Create Function Pin
Hesham Amin17-Oct-07 0:34
Hesham Amin17-Oct-07 0:34 
GeneralRe: Create Function Pin
Sarfaraj Ahmed17-Oct-07 1:54
Sarfaraj Ahmed17-Oct-07 1:54 
GeneralRe: Create Function Pin
Sarfaraj Ahmed17-Oct-07 2:14
Sarfaraj Ahmed17-Oct-07 2:14 
Questiondatatype mismatch Pin
sean0016-Oct-07 19:00
sean0016-Oct-07 19:00 
Hello, I was hoping someone could help me with an error I recieve during program execution. Code below with explanation below that. Codes in C# with Access backend.

public partial class Form1 : Form


{

public string conString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\\..\\testdatabase.mdb";

public OleDbConnection con;

public OleDbDataAdapter dAdapter;

public DataSet dSet;





public Form1()

{

InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)

{


}

private void button1_Click(object sender, EventArgs e)

{


con = new OleDbConnection(conString);

dAdapter = new OleDbDataAdapter("SELECT * FROM agent WHERE firstname = '" + textBox1.Text + "'", con);

dSet = new DataSet();

dAdapter.Fill(dSet);

DataTable datatable = dSet.Tables[0];

if (datatable.Rows.Count != 0)

{

textBox1.Text = (string)datatable.Rows[0][1];

textBox2.Text = (string)datatable.Rows[0][2];

}




}

I was running a test and noticed that , for instance, if my sql inquiry where modified to search the ID field in my database

SELECT * FROM agent WHERE agentid = '" + textBox1.Text + "'",

and when I enter a number into textbox1 say the number 1 , I get an error thrown in .net at the line below

dAdapter.Fill(dSet);

Which in short says "datatype mismatch" - I am successfully able to do SQL select inquiries with strings typed into the textbox but not numbers.

Also, the test database has 1 table with around 5 fields.
As spelled
( agentid, firstname,lastname,username,password)
1 bob jenkins bjenkins 1234
2 john willows jwillows 4321

I test the program by entering 1 into textbox1.

For the life of me I can't figure it out and do not have much experience.
Thanks in advance.
AnswerRe: datatype mismatch Pin
Giorgi Dalakishvili16-Oct-07 20:47
mentorGiorgi Dalakishvili16-Oct-07 20:47 
GeneralRe: datatype mismatch Pin
sean0017-Oct-07 5:40
sean0017-Oct-07 5:40 
GeneralRe: datatype mismatch Pin
Giorgi Dalakishvili17-Oct-07 6:00
mentorGiorgi Dalakishvili17-Oct-07 6:00 
AnswerRe: datatype mismatch Pin
pmarfleet16-Oct-07 20:51
pmarfleet16-Oct-07 20:51 
Questionneed advice - oracle client Pin
udikantz16-Oct-07 13:21
udikantz16-Oct-07 13:21 
AnswerRe: need advice - oracle client Pin
AETaylor18-Oct-07 21:42
AETaylor18-Oct-07 21:42 
QuestionADO.NET update/select question Pin
Tom Wright16-Oct-07 10:57
Tom Wright16-Oct-07 10:57 
AnswerRe: ADO.NET update/select question Pin
pmarfleet16-Oct-07 11:01
pmarfleet16-Oct-07 11:01 
AnswerRe: ADO.NET update/select question Pin
Christian Graus16-Oct-07 11:29
protectorChristian Graus16-Oct-07 11:29 
Jokeadd hour in business date/hour Pin
Nilton Jr16-Oct-07 8:02
Nilton Jr16-Oct-07 8:02 
GeneralRe: add hour in business date/hour Pin
Hesham Amin16-Oct-07 9:11
Hesham Amin16-Oct-07 9:11 
QuestionSelect into a variable Pin
Ahmad Adnan16-Oct-07 3:07
Ahmad Adnan16-Oct-07 3:07 
AnswerRe: Select into a variable Pin
Mike Dimmick16-Oct-07 3:13
Mike Dimmick16-Oct-07 3:13 
AnswerRe: Select into a variable Pin
Sandeep Kumar16-Oct-07 3:22
Sandeep Kumar16-Oct-07 3:22 
QuestionDTS - Data Transformation Services Pin
mihksoft16-Oct-07 2:39
mihksoft16-Oct-07 2:39 
AnswerRe: DTS - Data Transformation Services Pin
Hesham Amin16-Oct-07 3:41
Hesham Amin16-Oct-07 3:41 
GeneralRe: DTS - Data Transformation Services Pin
mihksoft16-Oct-07 3:48
mihksoft16-Oct-07 3:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.