Click here to Skip to main content
16,004,901 members
Home / Discussions / Database
   

Database

 
AnswerRe: Differance between '@variable' and '@@variable' in SQL Pin
Eric Dahlvang14-Jul-06 5:12
Eric Dahlvang14-Jul-06 5:12 
Questionnumeric data type value Pin
For_IT14-Jul-06 0:06
For_IT14-Jul-06 0:06 
AnswerRe: numeric data type value Pin
Mike Dimmick14-Jul-06 0:27
Mike Dimmick14-Jul-06 0:27 
GeneralRe: numeric data type value Pin
For_IT14-Jul-06 0:55
For_IT14-Jul-06 0:55 
GeneralRe: numeric data type value Pin
Mairaaj Khan14-Jul-06 2:02
professionalMairaaj Khan14-Jul-06 2:02 
GeneralRe: numeric data type value Pin
For_IT14-Jul-06 3:11
For_IT14-Jul-06 3:11 
AnswerRe: numeric data type value Pin
Heinz_15-Jul-06 14:27
Heinz_15-Jul-06 14:27 
Questionwhere not exists problem! Pin
richiemac13-Jul-06 23:19
richiemac13-Jul-06 23:19 
Hi all,

i'm trying to build a SQL statement,

commStr = "insert into mytable values(default,?number,?text,?date) " +<br />
            "select * from mytable " +<br />
            "where not exists(select * from mytable where int_field = '" + <br />
            System.Convert.ToInt32(TextBox1.Text) + "')";<br />


and I keep getting the following error

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> MySql.Data.MySqlClient.MySqlException: #42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select * from mytable where not exists(select * from mytable where int_field = '' at line 1<br />
   at MySql.Data.MySqlClient.PacketReader.CheckForError()<br />
   at MySql.Data.MySqlClient.PacketReader.ReadHeader()<br />
   at MySql.Data.MySqlClient.PacketReader.OpenPacket()<br />
   at MySql.Data.MySqlClient.NativeDriver.Prepare(String sql, String[] parmNames)<br />
   at MySql.Data.MySqlClient.MySqlCommand.Prepare()<br />
   at Service.InsertDB(String insStr, String connStr, Int32 inInt, String inText, String inDate)


the SQL string that is being passed looks like

insert into mytable values(default,?number,?text,?date) select * from mytable where not exists(select * from mytable where int_field = '20')<br />


What I'm trying to do is check that the entry is not already present in the database before i insert it.

Some help I'm going mad with this.

Thanks in advance.
AnswerRe: where not exists problem! Pin
Mike Dimmick14-Jul-06 0:23
Mike Dimmick14-Jul-06 0:23 
AnswerRe: where not exists problem! Pin
Eric Dahlvang14-Jul-06 3:21
Eric Dahlvang14-Jul-06 3:21 
AnswerThanks for the help guys Pin
richiemac14-Jul-06 3:35
richiemac14-Jul-06 3:35 
GeneralRe: Thanks for the help guys Pin
Eric Dahlvang14-Jul-06 5:50
Eric Dahlvang14-Jul-06 5:50 
AnswerRe: where not exists problem! Pin
Eric Dahlvang14-Jul-06 7:23
Eric Dahlvang14-Jul-06 7:23 
GeneralRe: where not exists problem! Pin
richiemac16-Jul-06 22:18
richiemac16-Jul-06 22:18 
Questionmaintaining the data type Pin
Jerry Hammond13-Jul-06 20:20
Jerry Hammond13-Jul-06 20:20 
AnswerRe: maintaining the data type Pin
Mike Dimmick14-Jul-06 0:24
Mike Dimmick14-Jul-06 0:24 
GeneralRe: maintaining the data type Pin
Jerry Hammond14-Jul-06 5:24
Jerry Hammond14-Jul-06 5:24 
QuestionMatch Case Comparision Pin
sumit siddheshwar13-Jul-06 18:23
sumit siddheshwar13-Jul-06 18:23 
AnswerRe: Match Case Comparision Pin
Edbert P13-Jul-06 19:26
Edbert P13-Jul-06 19:26 
GeneralRe: Match Case Comparision Pin
sumit siddheshwar13-Jul-06 20:07
sumit siddheshwar13-Jul-06 20:07 
AnswerRe: Match Case Comparision Pin
Mairaaj Khan14-Jul-06 3:06
professionalMairaaj Khan14-Jul-06 3:06 
QuestionTo many SQL Data Sources? Pin
Drathmar13-Jul-06 17:06
Drathmar13-Jul-06 17:06 
AnswerRe: To many SQL Data Sources? Pin
Colin Angus Mackay13-Jul-06 22:00
Colin Angus Mackay13-Jul-06 22:00 
AnswerRe: To many SQL Data Sources? Pin
mysorian15-Jul-06 4:47
professionalmysorian15-Jul-06 4:47 
QuestionA simple query :( [modified] Pin
xoxoxoxoxoxox13-Jul-06 16:35
xoxoxoxoxoxox13-Jul-06 16:35 

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.