Robby
Moderators-
Posts
3848 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Robby
-
In Admin Tools open Internet Services Manager, find the virtual directory for your project and set Read/Write permissions.
-
I can tell you that the error occured in your Page_Load event. Use a Try/Catch to handle your errors, when you catch an error send it to the browser in a Label or Response.Write.
-
jfackler, I was being sarcastic.
-
A recorset in .net ? Is that a new feature?
-
Post count always the highest value?
Robby replied to Nerseus's topic in Suggestions, Bugs, and Comments
Our original software at EVBF was like that, I've thought the same thing as you, but after a while you get used to checking the posting date. -
Just grab a Connection from the data - toolbar, it allows you to test the connection. or create a UDL file on your Desktop, right-click on your desktop > New > Text File > then rename the extension to .UDL
-
if ERMDSQLSERVER is a local server then try this instead 127.0.0.1
-
try this... DatabaseKey = "Server=ERMDSQLSERVER;" _ & "Trusted_Connection=yes;" _ & "database=ERMD;"
-
This may help http://www.distinct.com/products/vit32/docs/activex.mime.doc0024.asp or http://www.catalyst.com/support/help/cstools3/visual/mime/contenttypeproperty.html
-
This may help...http://www.xtremedotnettalk.com/showthread.php?s=&threadid=69196
-
In the Tools > Options you can set it to F8
-
Are you using a DataReader? you can do something like this... Dim dr As SqlDataReader Dim cmd As SqlCommand Dim con As New SqlConnection(YOUR_connString) Dim sSql As String = "SELECT user_name,user_password FROM users " & _ "WHERE user_name='" & _ txtUsername.Text & "' AND " & _ "user_password=PASSWORD('" & txtPassword.Text & "')" Try If con.State = ConnectionState.Closed Then con.Open() cmd = New SqlCommand(sSql, con) dr = cmd.ExecuteReader While dr.Read userName = dr.Fields.Item("user_name").Value userPass = dr.Fields.Item("user_password").Value End While Return False Catch Return False Finally If Not con.State = ConnectionState.Closed Then con.Close() If Not dr.IsClosed Then dr.Close() If Not cmd Is Nothing Then cmd.Dispose() End Try
-
7.0 and 2000 are supported by SQLClient
-
Do you want to eliminate the duplicates or are you doing something else?
-
Here's a sample using VB6, it can also be done in .NET. http://www.elitevb.com/content/01,0041,01/
-
I can't post the entire project as it's too large, so here's the relevant stuff.. Don't let the code in SetCommands() scare you. 'Call SetCommands() when you bind the Datagrid. 'Call daUpdate whenever you want to update the Datagrid. 'All variables prefixed with m_ are class members. Friend Sub daUpdate(ByVal ds As DataSet, ByVal sTable As String) Dim tran As SqlTransaction m_da.ContinueUpdateOnError = True 'update whatever we can Try If m_con.State = ConnectionState.Closed Then m_con.Open() tran = m_con.BeginTransaction(IsolationLevel.ReadCommitted) m_da.UpdateCommand.Transaction = tran m_da.InsertCommand.Transaction = tran m_da.DeleteCommand.Transaction = tran Catch ex As Exception MessageBox.Show(ex.ToString) End Try Try m_da.Update(ds.Tables(sTable)) tran.Commit() Catch ex As SqlException Try MessageBox.Show(ex.ToString) tran.Rollback() Catch RollbackEx As SqlException MessageBox.Show(RollbackEx.ToString) End Try Finally If m_con.State = ConnectionState.Open Then m_con.Close() End Try End Sub Friend Sub SetCommands() 'This routine Sets the Commands for the Data Adapter Try Dim cmdInsert As New SqlCommand() Dim cmdUpdate As New SqlCommand() Dim cmdDelete As New SqlCommand() With cmdInsert .CommandText = "INSERT INTO CLients(FirstName, LastName, Tel, SinClient)" _ & " VALUES (@FirstName, @LastName, @Tel, @SinClient); " _ & "SELECT FirstName, LastName, Tel, SinClient FROM Clients" _ & " WHERE (SinClient = @SinClient)" .Connection = m_con .Parameters.Add(New SqlParameter("@FirstName", SqlDbType.NVarChar, 15, "FirstName")) .Parameters.Add(New SqlParameter("@LastName", SqlDbType.NVarChar, 20, "LastName")) .Parameters.Add(New SqlParameter("@Tel", SqlDbType.NVarChar, 12, "Tel")) .Parameters.Add(New SqlParameter("@SinClient", SqlDbType.NVarChar, 9, "SinClient")) End With With cmdUpdate .CommandText = "UPDATE Clients SET " & _ "SinClient = @SinClient, " & _ "FirstName = @FirstName, " & _ "LastName = @LastName, " & _ "Tel = @Tel " & _ "WHERE " & _ "(SinClient = @Original_SinClient) " & _ "AND (FirstName = @Original_FirstName) " & _ "AND (Tel = @Original_Tel) " & _ "AND (LastName = @Original_LastName " & _ "OR @Original_LastName IS NULL AND LastName IS NULL); " & _ "SELECT SinClient, FirstName, LastName, Tel " & _ "FROM Clients " & _ "WHERE (SinClient = @SinClient)" .Connection = m_con .Parameters.Add(New SqlParameter("@SinClient", SqlDbType.NVarChar, 9, "SinClient")) .Parameters.Add(New SqlParameter("@FirstName", SqlDbType.NVarChar, 15, "FirstName")) .Parameters.Add(New SqlParameter("@LastName", SqlDbType.NVarChar, 20, "LastName")) .Parameters.Add(New SqlParameter("@Tel", SqlDbType.NVarChar, 12, "Tel")) .Parameters.Add(New SqlParameter("@Original_SinClient", SqlDbType.NVarChar, 9, _ System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "SinClient", _ System.Data.DataRowVersion.Original, Nothing)) .Parameters.Add(New SqlParameter("@Original_FirstName", SqlDbType.NVarChar, 15, _ System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "FirstName", _ System.Data.DataRowVersion.Original, Nothing)) .Parameters.Add(New SqlParameter("@Original_LastName", SqlDbType.NVarChar, 20, _ System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "LastName", _ System.Data.DataRowVersion.Original, Nothing)) .Parameters.Add(New SqlParameter("@Original_Tel", SqlDbType.NVarChar, 12, _ System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Tel", _ System.Data.DataRowVersion.Original, Nothing)) End With With cmdDelete .CommandText = "DELETE " & _ "FROM CLients " & _ "WHERE ( " & _ "SinClient = @Original_SinClient) " & _ "AND (FirstName = @Original_FirstName) " & _ "AND (Tel = @Original_Tel) " & _ "AND (LastName = @Original_LastName " & _ "OR @Original_LastName IS NULL AND LastName IS NULL)" .Connection = m_con .Parameters.Add(New SqlParameter("@Original_SinClient", System.Data.SqlDbType.NVarChar, 9, _ System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "SinClient", _ System.Data.DataRowVersion.Original, Nothing)) .Parameters.Add(New SqlParameter("@Original_FirstName", System.Data.SqlDbType.NVarChar, 15, _ System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "FirstName", _ System.Data.DataRowVersion.Original, Nothing)) .Parameters.Add(New SqlParameter("@Original_LastName", System.Data.SqlDbType.NVarChar, 20, _ System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "LastName", _ System.Data.DataRowVersion.Original, Nothing)) .Parameters.Add(New SqlParameter("@Original_Tel", System.Data.SqlDbType.NVarChar, 12, _ System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Tel", _ System.Data.DataRowVersion.Original, Nothing)) End With With m_da .InsertCommand = cmdInsert .UpdateCommand = cmdUpdate .DeleteCommand = cmdDelete End With Catch End Try End Sub
-
It's only because I had already read your previous 8 posts and found that since you are advanced in .NET, you would've already been aware of what Volte pointed out. So I was thinking it was something else that you were after. To make a long story short, I'll stop typing now. :)
-
Yeah it's very possible, I'll try and put a sample together. (or if anyone else wants to jump in)
-
Steve, is that what you ment? If so, boy was I on the wrong track. :( [edit] I guess it was, (we posted at the same time)
-
use the ExcecuteNonQuery method of SqlCommand/OleDbCommand. Then set the commandText = "Update myTable ...." query
-
As far as I know, VS 2002 does not have this feature, perhaps in the 2003 release.
-
divil, nice one. I learn something new every day. :)
-
oh, good point.
-
My code is not a solution, merely a suggestion on a leaner layout. To take it a step further I would place ALL the code within the IsPostBack into its' own routine. Private Sub Page_Load(sender As Object, e As eventargs) Dim objCN As OleDbConnection ' Database Connection object Dim objDA As OleDbDataAdapter ' Database Adaptor object Dim objDS As DataSet ' Dataset object Dim objCM As OleDbCommand Dim strSQL As String Dim strCN As String Dim intSelection As Integer = CInt(Request.QueryString("selection")) If Not IsPostBack Then strCN = "PROVIDER = Microsoft.Jet.OLEDB.4.0;" & _ "DATA SOURCE=" & Server.MapPath("./db/datastore.mdb") objCN = New OleDbConnection( strCN ) objCN.Open() strSQL = GetSql(intSelection) objDA = New OleDbDataAdapter( strSQL, objCN ) objDS = New DataSet objDA.Fill (objDS, "tblProduct") objCN.Close() ProductList.DataSource = objDS.Tables("tblProduct").DefaultView ProductList.DataBind() End If End Sub Private Function GetSql(ByVal intSelection As Integer) As String Dim s As String = "SELECT * FROM (tblProduct LEFT JOIN tblCategory on tblProduct.ProdCat=tblCategory.CategoryID) WHERE Category=" Select Case intSelection Case 0 Return s & "'Stainless' " Case 1 return s & "'Specialty' " Case 2 return s & "'Lefty'" Case 3 return s & "'Clipper' " Case 4 return s & "'Iron' " Case 5 return s & "'Custom' " Case 6 return s & "'Comb' " Case 7 return s & "'Cobalt' " Case 8 return s & "'Dryer' " Case Else return "SELECT * from tblProduct" End Select End Function
-
I don't know how to get the parameter names from the report, but couldn't you just hard-code the parameters into a combobox. Or if your building the report parameters at runtime then you already have access to them. Of course getting the list directly from the report would be better.