| Author: Milind Kansagara 03 Jul 2009 | Member Level: Gold | Rating:  Points: 2 |
you can make one procedure and execute that procedure using vb .net here i am providing how to call procedure example in c# you can convert his to VB .net just syntactical difference will be there Database objDatabase = DatabaseFactory.CreateDatabase(); DbCommand objDbCommand = objDatabase.GetStoredProcCommand("usp_Testimonial_List");
objDatabase.AddInParameter(objDbCommand, "@TestimonialID", DbType.Int32, this.TestimonialID);
DataSet dsTestimonialList = objDatabase.ExecuteDataSet(objDbCommand);
return dsTestimonialList.Tables[0].Rows.Count > 0 ? dsTestimonialList.Tables[0].Rows[0] : null;
Regards, Milind Kansagara Web Developer (Cybercomcreation) Ahmedabad. http://milindkansagara1984.blogspot.com
|
| Author: Nikhil Gaur 03 Jul 2009 | Member Level: Diamond | Rating:  Points: 2 |
use this resource on DNS
http://www.dotnetspider.com/resources/29151-Use-SQL-stored-procedure-ADO-NET-code.aspx
Join this campus group http://www.dotnetspider.com/sites/637/-ecb-aspdotnet.aspx
Thanks & Regards NIks My Software and Web Development Experience
|
| Author: Ramesh S 03 Jul 2009 | Member Level: Gold | Rating:  Points: 2 |
Try this
Public Overrides Sub Execute_SqlScript(ByVal fileName As String, ByVal database As String)
Dim sr As StreamReader = Nothing
Dim sb As StringBuilder = Nothing
Dim line As String = ""
Try
Command_Type = CommandType.Text
Command_Create()
Connection_Open()
Transaction_Begin()
sr = New StreamReader(fileName)
Do
sb = New StringBuilder
Do
line = sr.ReadLine()
If (line = "GO" Or line Is Nothing) Then Exit Do
sb.Append(ControlChars.CrLf & line)
Loop
If line Is Nothing Then Exit Do
objSQLCommand.CommandText = sb.ToString
objSQLCommand.ExecuteNonQuery()
Loop Until line Is Nothing
If Me.Transaction_Exists Then Me.Transaction_Commit()
Catch ex As Exception
Transaction_Rollback()
Throw New aExceptions.BespokeException(ex, _
aExceptions.BespokeException.enmType.SERVER_SQLERROR, _
"MSSQL2005: Execute_SqlScript(2)")
Finally
If sr IsNot Nothing Then sr.Close()
Reset()
End Try
End Sub
Thanks & Regards Ramesh. S My Articles & Resources at DNS
|
| Author: Mohsin 04 Jul 2009 | Member Level: Silver | Rating:  Points: 2 |
Public Overrides Sub Execute_SqlScript(ByVal fileName As String, ByVal database As String)
Dim sr As StreamReader = Nothing
Dim sb As StringBuilder = Nothing
Dim line As String = ""
Try
Command_Type = CommandType.Text
Command_Create()
Connection_Open()
Transaction_Begin()
sr = New StreamReader(fileName)
Do
sb = New StringBuilder
Do
line = sr.ReadLine()
If (line = "GO" Or line Is Nothing) Then Exit Do
sb.Append(ControlChars.CrLf & line)
Loop
If line Is Nothing Then Exit Do
objSQLCommand.CommandText = sb.ToString
objSQLCommand.ExecuteNonQuery()
Loop Until line Is Nothing
If Me.Transaction_Exists Then Me.Transaction_Commit()
Catch ex As Exception
Transaction_Rollback()
Throw New aExceptions.BespokeException(ex, _
aExceptions.BespokeException.enmType.SERVER_SQLERROR, _
"MSSQL2005: Execute_SqlScript(2)")
Finally
If sr IsNot Nothing Then sr.Close()
Reset()
End Try
End Sub
|