Click here to Skip to main content
15,896,154 members
Home / Discussions / Database
   

Database

 
AnswerRe: Datatype for NULL Pin
Mike Dimmick17-Oct-07 2:22
Mike Dimmick17-Oct-07 2:22 
GeneralRe: Datatype for NULL Pin
N a v a n e e t h17-Oct-07 2:41
N a v a n e e t h17-Oct-07 2:41 
GeneralRe: Datatype for NULL Pin
Colin Angus Mackay17-Oct-07 2:45
Colin Angus Mackay17-Oct-07 2:45 
GeneralRe: Datatype for NULL Pin
N a v a n e e t h17-Oct-07 2:50
N a v a n e e t h17-Oct-07 2:50 
GeneralRe: Datatype for NULL Pin
Mike Dimmick17-Oct-07 6:33
Mike Dimmick17-Oct-07 6:33 
GeneralRe: Datatype for NULL Pin
N a v a n e e t h17-Oct-07 18:26
N a v a n e e t h17-Oct-07 18:26 
AnswerRe: Datatype for NULL Pin
Pete O'Hanlon17-Oct-07 2:26
mvePete O'Hanlon17-Oct-07 2:26 
GeneralRe: Datatype for NULL Pin
N a v a n e e t h17-Oct-07 2:39
N a v a n e e t h17-Oct-07 2:39 
GeneralRe: Datatype for NULL Pin
Pete O'Hanlon17-Oct-07 2:56
mvePete O'Hanlon17-Oct-07 2:56 
QuestionMDX + Trasnsactional Level Pin
GChannon17-Oct-07 2:00
GChannon17-Oct-07 2:00 
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 

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.