Click here to Skip to main content
16,010,673 members
Home / Discussions / Database
   

Database

 
AnswerRe: Sql to Excel Pin
_AK_19-Sep-06 21:39
_AK_19-Sep-06 21:39 
Questionright alignment of data Pin
kodulkar_nilesh19-Sep-06 20:58
kodulkar_nilesh19-Sep-06 20:58 
QuestionSQL Server Query Help (Trying to compare two tables and display the nonmatching records Pin
choorakkuttyil19-Sep-06 20:12
choorakkuttyil19-Sep-06 20:12 
AnswerRe: SQL Server Query Help (Trying to compare two tables and display the nonmatching records Pin
Michael Potter20-Sep-06 5:11
Michael Potter20-Sep-06 5:11 
QuestionDatatype conversion in a SQL statement - need help Pin
Slow Learner19-Sep-06 2:38
Slow Learner19-Sep-06 2:38 
AnswerRe: Datatype conversion in a SQL statement - need help Pin
albCode19-Sep-06 4:42
albCode19-Sep-06 4:42 
QuestionDifference between SqlCommand and SqlCommandBuilder Pin
param thaker19-Sep-06 2:30
param thaker19-Sep-06 2:30 
AnswerRe: Difference between SqlCommand and SqlCommandBuilder Pin
Kschuler19-Sep-06 10:57
Kschuler19-Sep-06 10:57 
A Command object is used to execute scalar or non query commands to a database. You would set a command objects CommandText property to and sql statement that you want to run and then use it's ExecuteScalar or ExecuteNonQuery method to run it. Here is an example:

Dim conn As New SqlClient.SqlConnection(strMyConnectionString)
Dim cmd As New SqlClient.SqlCommand()
cmd.CommandText = "UPDATE myTable SET col1='my value'"
cmd.ExecuteNonQuery()


A CommandBuilder object is used to automatically create Update, Delete, and Insert SQL statements for you, based on a Select statament that you supply. You would declare a DataAdapter object, set it's SelectCommand.CommandText property to your Select SQL statement. Then when you declare a CommandBuilder object, you include the dataadapter in the CommandBuilder's constructor parameter and it will automatically create the other statements for you when you run a DataAdapter. Here is an example:

Dim conn As New SqlClient.SqlConnection(strMyConnectionString)
Dim cmd As New SqlClient.SqlCommand()
cmd.CommandText = "SELECT * FROM myTable"
Dim da As New SqlClient.SqlDataAdapter(cmd)
Dim cb As New SqlClient.SqlCommandBuilder(da)
da.Update(myDataTable)


If you hadn't of used a CommandBuilder, the program would have blown up on the da.Update(myDataTable) statement, because the adapter wouldn't have known how to insert new rows that had been added to the table, or delete rows that had been removed, etc.
GeneralRe: Difference between SqlCommand and SqlCommandBuilder Pin
Rob Graham19-Sep-06 12:59
Rob Graham19-Sep-06 12:59 
QuestionReporting Services Parameter Dependencies Pin
CandyMe19-Sep-06 1:18
CandyMe19-Sep-06 1:18 
QuestionSelect Column (as Parameter) from Table Pin
CandyMe19-Sep-06 0:52
CandyMe19-Sep-06 0:52 
AnswerRe: Select Column (as Parameter) from Table Pin
_AK_19-Sep-06 1:28
_AK_19-Sep-06 1:28 
AnswerRe: Select Column (as Parameter) from Table Pin
albCode19-Sep-06 5:13
albCode19-Sep-06 5:13 
GeneralRe: Select Column (as Parameter) from Table Pin
CandyMe19-Sep-06 16:23
CandyMe19-Sep-06 16:23 
AnswerRe: Select Column (as Parameter) from Table Pin
Michael Potter20-Sep-06 5:32
Michael Potter20-Sep-06 5:32 
GeneralRe: Select Column (as Parameter) from Table Pin
CandyMe20-Sep-06 17:20
CandyMe20-Sep-06 17:20 
QuestionSystem.Data.DB.ConcurrencyException Pin
kishorepv18-Sep-06 23:10
kishorepv18-Sep-06 23:10 
AnswerRe: System.Data.DB.ConcurrencyException Pin
_AK_19-Sep-06 1:32
_AK_19-Sep-06 1:32 
GeneralRe: System.Data.DB.ConcurrencyException Pin
kishorepv19-Sep-06 19:33
kishorepv19-Sep-06 19:33 
GeneralRe: System.Data.DB.ConcurrencyException Pin
_AK_19-Sep-06 19:36
_AK_19-Sep-06 19:36 
GeneralRe: System.Data.DB.ConcurrencyException Pin
kishorepv19-Sep-06 21:16
kishorepv19-Sep-06 21:16 
GeneralRe: System.Data.DB.ConcurrencyException Pin
_AK_19-Sep-06 21:21
_AK_19-Sep-06 21:21 
GeneralRe: System.Data.DB.ConcurrencyException Pin
kishorepv19-Sep-06 21:30
kishorepv19-Sep-06 21:30 
GeneralRe: System.Data.DB.ConcurrencyException Pin
_AK_19-Sep-06 21:37
_AK_19-Sep-06 21:37 
GeneralRe: System.Data.DB.ConcurrencyException Pin
kishorepv19-Sep-06 23:04
kishorepv19-Sep-06 23:04 

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.