•  Nico
  • 98% (Exalted)
  • YAF Commander Topic Starter
Good morning everybody. Now it's 9 at Beijing, weather's cloudy after night rain, little windy (all this is good for Olympics pollution).

I am currently trying to add two new fields in the Post New Topic form.

I work on my Code Exchange site.
I want my users to add the language they are going to use in the topic, and also to say if needed which IDE (VB, C++, C#,.NET,...) their topic is about.

Some of this works for now, some not, I'm still on it.

- I have added the two new fields in database (dbo.yaf_Topics). No pb it works with no pb in the tool.
- I have added 2 asp:DropDownList in postmessage.ascx and the list elements in postmessage.ascx.cs (just like 'Priority'). This works, the new fields appear, no pb with the general use of the tool.

- The problem is now to get these fields value and to add them into the database. For this it is necessary to modify the source code of YAF.Classes.Data.dll as we must act on DB.cs (DB.topic_save() function is called by PostReplyHandleNewPost() function in postmessage.ascx.cs).
I have add 2 cmd.Parameters.AddWithValue() in DB.cs (also add the 2 object parameters in function inputs), and also added these input parameters in postmessage.ascx.cs.
I have then build again YAF.Classes.Data.dll thanks to Visual Studio 2005, and put the new .dll in my bin directories.

But it currently stops here with this error message :
'Procedure or function yaf_topic_save has too many arguments specified' coming from postmessage.ascx.cs.
But I now have 14 arguments (input parameters) in my function, both in postmessage.ascx.cs and in DB.cs...

I work on this.

If someone has an idea or a comment, he's welcome:wink:
  •  Nico
  • 98% (Exalted)
  • YAF Commander Topic Starter
I don't really understand how the NewTopic data is saved:?: :

In postmessage.ascx.cs file, within PostReplyHandleNewPost() function, it is said that DB.topic_save() is supposed to do that :
// Save to Db
long topicID = DB.topic_save(...12 input parameters...);

When you go to the source code for YAF.Classes.Data, in the DB.cs function, all the 12 input parameters are added in a SqlCommand which name is 'cmd'.
All that I can see is that all these parameters are not directly linked to the dbo.yaf_topics table in the data base.

'cmd' is made thanks to DBAccess.GetCommand( "topic_save" ).
In DBAccess.cs (always in YAF.Classes.Data), GetCommand with only one input parameters returns GetCommand(storedProcedure, null), the same with 2 input parameters (the second is null)...
In fact, it just creates a new StoredProcedure which name is "topic_save" and connection is null...
A new DataTable called 'dt' is created thanks to DBAccess.GetData() function.
This function with one parameter returns DBAccess.GetData(cmd, false), the same with two parameters.
This one is supposed to return GetDatasetBasic( cmd, transaction ).Tables [0].

If somebody can explain me at which step the 12 parameters data are sent to the database and in which tables, it would be a pleasure, because now I can only :cry:

(don't forget that my final goal is to have 14 parameters)
  •  Jaben
  • 100% (Exalted)
  • YAF Developer
We are not talking about tables. YAF uses STORED PROCEDURES. topic_save is a stored procedure that takes 12 parameters.

And yes, it works.
  •  Nico
  • 98% (Exalted)
  • YAF Commander Topic Starter
Thanks. I'm gonna take a closer look on the web on how these stored procedures work.
Is it possible to access these procedures somewhere in the source?
  •  Nico
  • 98% (Exalted)
  • YAF Commander Topic Starter
Ok I got it.
Didn't know there were some procedures 'hidden' into the database, just discovering .net.

I have succeeded in adding my 2 new fields in the New Topic form and also modified the 'Search' tool to take them into account.
I write a whole how to on it and upload it as soon as it's ready...
  •  Nico
  • 98% (Exalted)
  • YAF Commander Topic Starter
Not possible to upload here.

Solution in:


About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved