Click here to Skip to main content
15,891,689 members
Home / Discussions / Database
   

Database

 
QuestionPaging Pin
Pdh098211-Jul-07 7:22
Pdh098211-Jul-07 7:22 
AnswerRe: Paging Pin
Pete O'Hanlon11-Jul-07 10:13
mvePete O'Hanlon11-Jul-07 10:13 
AnswerRe: Database Object. Pin
Colin Angus Mackay11-Jul-07 7:05
Colin Angus Mackay11-Jul-07 7:05 
GeneralRe: Database Object. Pin
Pdh098211-Jul-07 8:42
Pdh098211-Jul-07 8:42 
GeneralRe: Database Object. Pin
Harini N K11-Jul-07 19:01
Harini N K11-Jul-07 19:01 
QuestionSQL script [modified] Pin
kibromg11-Jul-07 6:05
kibromg11-Jul-07 6:05 
AnswerRe: SQL script Pin
RepliCrux11-Jul-07 19:42
RepliCrux11-Jul-07 19:42 
QuestionSQL and VB.NET identity insert problem. Pin
aqzman_11-Jul-07 5:45
aqzman_11-Jul-07 5:45 
Hi guys, I hope this is the right section, but as it's more of a SQL problem, it most likly is.

Anyway, my problem is that I get this error:

"DEFAULT or NULL are not allowed as explicit identity values."

Everytime I try to run my code, but of all the searhing I've done on Google and Google code search I really can't find anything amiss. I'll post my source (What I think is needed) at the bottem. If there are any important lines of code that I've left out ask and I'll promptly post them.

Dim mySelectQuery As String = "SELECT * FROM tblCallers SET IDENTITY_INSERT tblCallers ON"
Dim myInsertQuery As String = "INSERT INTO tblCallers (CallerID, Name, Address, PostalCode, City, PhoneNumber, EmailAddress) VALUES(DEFAULT, '" & Name & "', '" & Address & "', '" & PostalCode & "', '" & City & "', '" & PhoneNum & "', '" & EmailAddress & "')"
Dim myConnection As New Data.SqlClient.SqlConnection(myConnString)
Dim myCommand As New Data.SqlClient.SqlCommand(mySelectQuery, myConnection)
Dim myCommand2 As New Data.SqlClient.SqlCommand(myInsertQuery, myConnection)
Dim retvalue As Integer
myConnection.Open()
retvalue = myCommand2.ExecuteNonQuery()
Console.WriteLine(retvalue)
Dim myReader As Data.SqlClient.SqlDataReader
myReader = myCommand.ExecuteReader()
myReader.Close()
myConnection.Close()


I know that the code works because I use took it from another program I wrote and added the "SET IDENTITY_INSERT tblCallers ON" line. Also, the CallerID field is an Identity field.

Thanks,
aqzman
AnswerRe: SQL and VB.NET identity insert problem. Pin
Colin Angus Mackay11-Jul-07 5:51
Colin Angus Mackay11-Jul-07 5:51 
GeneralRe: SQL and VB.NET identity insert problem. Pin
aqzman_11-Jul-07 6:13
aqzman_11-Jul-07 6:13 
GeneralRe: SQL and VB.NET identity insert problem. Pin
Colin Angus Mackay11-Jul-07 6:51
Colin Angus Mackay11-Jul-07 6:51 
GeneralRe: SQL and VB.NET identity insert problem. Pin
sidbaruah12-Jul-07 19:40
sidbaruah12-Jul-07 19:40 
AnswerRe: SQL and VB.NET identity insert problem. Pin
Giorgi Dalakishvili11-Jul-07 5:54
mentorGiorgi Dalakishvili11-Jul-07 5:54 
QuestionBulk Insert Pin
Ashwiniyer11-Jul-07 3:28
Ashwiniyer11-Jul-07 3:28 
QuestionRe: Bulk Insert Pin
andyharman11-Jul-07 6:14
professionalandyharman11-Jul-07 6:14 
AnswerRe: Bulk Insert Pin
Ashwiniyer11-Jul-07 6:30
Ashwiniyer11-Jul-07 6:30 
GeneralRe: Bulk Insert Pin
andyharman11-Jul-07 11:33
professionalandyharman11-Jul-07 11:33 
QuestionQuestion .(Need immidiate reply Please) Pin
Karuna Kumar11-Jul-07 2:30
Karuna Kumar11-Jul-07 2:30 
AnswerRe: Question .(Need immidiate reply Please) Pin
Colin Angus Mackay11-Jul-07 2:52
Colin Angus Mackay11-Jul-07 2:52 
GeneralRe: Question .(Need immidiate reply Please) Pin
Paul Conrad11-Jul-07 7:08
professionalPaul Conrad11-Jul-07 7:08 
AnswerRe: Question .(Need immidiate reply Please) Pin
Vasudevan Deepak Kumar11-Jul-07 3:56
Vasudevan Deepak Kumar11-Jul-07 3:56 
QuestionConvert string in DB to DateTime in .NET Pin
blackjack215011-Jul-07 1:58
blackjack215011-Jul-07 1:58 
AnswerRe: Convert string in DB to DateTime in .NET Pin
kubben11-Jul-07 2:54
kubben11-Jul-07 2:54 
AnswerRe: Convert string in DB to DateTime in .NET Pin
Karuna Kumar11-Jul-07 2:56
Karuna Kumar11-Jul-07 2:56 
AnswerRe: Convert string in DB to DateTime in .NET Pin
Pete O'Hanlon11-Jul-07 10:14
mvePete O'Hanlon11-Jul-07 10:14 

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.