
MrNorth
Members-
Posts
11 -
Joined
-
Last visited
MrNorth's Achievements
Newbie (1/14)
0
Reputation
-
I am using reflection to interate through some assemblies in a directory... Im using the visitor pattern to check each assembly for a constructor signature similar to the one as input parameter, like : MyObjFactory.GetObject("class1", {"test",6}) What I want to do is to create an object using that constructor signature (string, int32) and return it.. The object will be created using "constructor.Invoke" any clues or hints? Henrik
-
well this data tier is using command objects and can execute both SPs textcommands and tablecommands. It is not only for reading data... kind regards HEnrik
-
thanks for the reply, but that resulted in an empty dataset :( If I run the code without transactions, it works great If you are curious this is a data tier based on singleton and abstract factory patterns... that is why I have wrapper classes for everything, even datasets and datareaders yours Henrik
-
I need help with a piece of code I am writing... I thought this was really genious, but it turns out it doesn't work. Howcome? Here is the code: Try m_conOleDb.ConnectionString = g_ConnStrings.GetInstance.GetConnectStringByPhase(Request.DesignPhase) m_conOleDb.Open() With cmdOleDb .Connection = m_conOleDb .CommandText = Request.Command .CommandType = Request.CommandType End With 'If any parameters exist in the Request object, add them If Request.Parameters.Count > 0 Then For Each oParam In Request.Parameters prmOleDb = cmdOleDb.Parameters.Add(oParam.ParamName, oParam.ParamValue) Next End If 'We check if the command uses a transaction or not If Request.Transactional Then tranOleDb = m_conOleDb.BeginTransaction End If 'Create a dataadapter and pass the command as a parameter daOleDb = New OleDbDataAdapter(cmdOleDb) daOleDb.Fill(oDataSetOleDb.ReturnedDataSet) Return oDataSetOleDb Catch exOleDb As OleDbException Request.Exception = exOleDb If Request.Transactional Then tranOleDb.Rollback() End If Catch ex As Exception Request.Exception = ex If Request.Transactional Then tranOleDb.Rollback() End If Finally If Request.Transactional Then tranOleDb.Commit() End If If m_conOleDb.State = ConnectionState.Open Then m_conOleDb.Close() End If End Try the problem is wiht the transactions. I get an exception on the line " tranOleDb.Commit()" saying "This OleDbTransaction has completed; it is no longer usable" What is the problem? If I don't use transactions, it works just great :) kind regards Henrik
-
I want to show a really simple example 1) class Request 'some stuff in Request class class Param 'Stuff in Param end class end class How do I draw this as UML class diagram in visio, the relationship between the class and it's subclass??? 2) class Request 'some stuff in Request class class Param 'Stuff in Param end class end class class DBManager dim myRequest as new Request end class Is there a way in UML class diagrams to show that the DBManager class is creating an instance of the Request class, or should I use another diagram to show that??? Im pretty experienced in OO, but a beginner in Visio and UML... Im forcing myself to use UML on all my projects, and sometimes there stupid questions arise... aspecially with abstract classes where it is difficult to realize how things work together (easier with classes like Driver, Car, Engine, Wheel etc) ANyway, if someone can provide an explanation, be my guest!!! I really want to learn how to make good UML diagrams...
-
I have worked a lot with asp.net and vb.net and now I have to write a windows application that can exchange datarows by using drag and drop methods I want to be able to select one datarow on grid1 and then place that on a certain row at grid2. On the events the underlying database will change. I have one problem, I don't have a clue how to do this. The datagrid in vb forms is a lot different than the asp.net datagrid. Can someone point me to a good article that explains the basics of drag-drop (I understand that all forms objects support these events). But which events do I have to handle, and how do I handle them? This is my first windows forms .net application, but I have 2 years of experience developing asp.net and I know vb.net pretty good. kind regards Henrik ps I did a search on the forum, but found nothing useful on the topic, no solid information... ds
-
ahh exactly what i was looking for, thanks
-
Well, I was more thinking about some ideas about how to incorporate full error management for enterprise applications, like database logging etc etc... and how the .net exception class should be incorporated into that... Just some suggestions how to do the class specs for such a component. You see, on my company we are designing plenty of web applications for 100-5000 users, but the error management components for these appls are somewhat lacking, to say the least. And now with the OO design of .net I thought it might be wise to design a reusable component that can be used anywhere in the code-behind. Something every class can use, I was thinking about designing some kind of interface but since I haven't been able to find information about designpatterns for error management, I am kind of in the dark. We use the GRASP patterns for our software design... In short terms, I want to give error management a professional look and to fully use the concept of OO and reusable code. I dunno, perhaps it is enough to just write a class/interface that accepts an exception object and take action depending on that. But how about if the user want logging enabled, and what about write the trace log to file? How is error management components written in other projects/applications? Perhaps some could share your ideas-thoughts? Perhaps we have a discussion goin' on here ;) kind regards Henrik
-
You do not have to bother with hidden variables in asp.net cause the framework handles this for you!! I recommend you read and fully understand the concept of viewstate and how postback works in asp.net! Short, I can say that all the values in your form page will automatically be saved in the viewstate upon postback (unless the control has enableviewstate = false) You can access values in the viewstate by using "viewstate" object... it is a whole new concept in asp.net... forget manual editing of hidden fields. About your querystring, is it possible to make <%=var%> in asp.net? I suggest you check <%# databinder.eval(somevalue) %> the <%# is a databinding expression and is used when you in the asp page want to bind a value to something... it might not work in this case since you ar enot really binding the value to a control, but do a search on the forums for querystrings in asp.net... kind regards Henrik
-
I am starting to build a web application, and I have learned all the tricks of OO programming like interfaces polymorphism and so on. I am only having problems converting the theory into practise... I want to create a generic class that works as an "error handler", meaning that I will use this in all the "catch" statements in my rather large asp.net application. Which is the best way to do this, and perhaps the .net framework has an even better way to handle errors? I want the ability to log custom messages and exception messages. Can I use OO in any way here? kind regards Henrik
-
I have a wierd problem. I have made a copy/paste from one of my programs that finns a datagrid with values from a sql db. And it works fine in that example, but when I use the same code with the oledb and an access db I get an error... here is the code for the updatecommand protected void DataGrid1_UpdateCommand(object source, DataGridCommandEventArgs e) { OleDbConnection myConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\inetpub\wwwroot\webreport\userdb.mdb"); OleDbCommand cmd = new OleDbCommand("Update",myConn); cmd.CommandType = CommandType.StoredProcedure; OleDbParameter param = new OleDbParameter(); string userid = DataGrid1.DataKeys[e.Item.ItemIndex].ToString(); param = cmd.Parameters.Add("@puserid",OleDbType.varchar); param.Direction = ParameterDirection.Input; param.Value = userid; string username = ((TextBox)e.Item.Cells[1].Controls[0]).Text; param = cmd.Parameters.Add("@pusername",OleDbType.VarChar); param.Direction = ParameterDirection.Input; param.Value = username; string password = ((TextBox)e.Item.Cells[2].Controls[0]).Text; param = cmd.Parameters.Add("@ppassword",OleDbType.VarChar); param.Direction = ParameterDirection.Input; param.Value = password; string admin = ((TextBox)e.Item.Cells[3].Controls[0]).Text; param = cmd.Parameters.Add("@padmin",OleDbType.Boolean); param.Direction = ParameterDirection.Input; param.Value = System.Convert.ToBoolean(admin); cmd.Connection.Open(); cmd.ExecuteNonQuery(); cmd.Connection.Close(); DataGrid1.EditItemIndex = -1; BindGrid(); } The error occurs on the line string userid = DataGrid1.DataKeys[e.Item.ItemIndex].ToString(); and the error is: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index The only thing I can think of is that primary keys are different in Access and SQL... other than that there is no difference between the code... The stored procedure looks like: UPDATE reportusers SET username = [@pusername], [password] = [@ppassword], admin = [@padmin] WHERE userid=[@puserid]; any help would be nice! This is a wierd problem... kind regards Henrik [edit]changed PHP tags for VB tags [/edit]