|
Thanks for the info friend.
I have already installed ODAC and as per your guidance also followed the instructions given on the page provided by you. But unfortunately it didn't work.
|
|
|
|
|
Your gonna have to check if the listener is even running, check the port on the firewall, and so forth in order to get it working.
But you never said if the Oracle database software is running remote or local, 2 different sets of items to check.
It's really no different than configuring MySQL or SQL Server. You may want to start searching post on the oracle website to get some ideas of what to do.
https://community.oracle.com/thread/371929?tstart=0[^]
|
|
|
|
|
My oracle is running on local machine. It is a project which i am doing as a part of my training on asp .net.
So i have installed Oralce 11g server and client on my laptop. Also installed ODAC and configured it according to the instructions given on the page provided by you. But unfortunately it didn't work out.
I think I need to do some more research on Internet for this issue.
Thanks for help.
|
|
|
|
|
I remember the first time I loaded up SQL software and tried to connect. I t took me awhile to get it working. Basically you have a
Protocol
Port Number
that have to match in asp.net and Oracle.
So you start with the Oracle Database Manager, make sure it can connect to the database.
Make sure you have an account with permission to connect, Select, insert, update, delete
Make a database with the manager,
Then start with the asp,net, and do the same thing again, test your connection string
Try the Oracle native client first, you have to import it or register it.
When that works, then you can try the ODBC or whatever you plan to use.
|
|
|
|
|
|
Hi There,
Can anyone help, I am having trouble posting a form to a Table in my database. I am getting a ERROR "Procedure or function SPInsertIndividual has too many arguments specified.", Can anyone help it would be very much appreciated.
My SP Code is:
CREATE PROCEDURE [dbo].[SPInsertIndividual]
(
@IndividualID int OUTPUT,
@TypeName nvarchar(200),
@RankName nvarchar(200),
@TitleName nvarchar(200),
@FamilyName nvarchar(200),
@FirstName nvarchar(200),
@MiddleName1 nvarchar(200),
@MiddleName2 nvarchar(200),
@MiddleName3 nvarchar(200),
@Gender nvarchar(20),
@DOB nvarchar(200),
@CountryName nvarchar(200),
@StateName nvarchar(200),
@CityName nvarchar(200),
@Verification nvarchar(200),
@DateCreated DateTime
)
AS
BEGIN
SET NOCOUNT ON
INSERT INTO dbo.tblIndividual(TypeName, RankName, TitleName, FamilyName, FirstName, MiddleName1, MiddleName2, MiddleName3, Gender, DOB, CountryName, StateName, CityName, Verification, DateCreated, IndividualID)
VALUES(@TypeName, @RankName, @TitleName, @FamilyName, @FirstName, @MiddleName1, @MiddleName2, @MiddleName3, @Gender, @DOB, @CountryName, @StateName, @CityName, @Verification, @DateCreated, @IndividualID)
END
Aspx.cs Code is
protected void btnSubmit_Click(object sender, EventArgs e)
{
String strConnString = ConfigurationManager.ConnectionStrings["AspGenealogy"].ConnectionString;
SqlConnection con = new SqlConnection(strConnString);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "SPInsertIndividual";
var id = new SqlParameter("IndividualID", System.Data.SqlDbType.Int);
id.Direction = System.Data.ParameterDirection.Output;
cmd.Parameters.Add(id);
cmd.Parameters.Add("@IndividualID", SqlDbType.Int);
cmd.Parameters.Add("@TypeName", SqlDbType.VarChar).Value = ddlType.SelectedItem.Text.Trim();
cmd.Parameters.Add("@RankName", SqlDbType.VarChar).Value = ddlRank.SelectedItem.Text.Trim();
cmd.Parameters.Add("@TitleName", SqlDbType.VarChar).Value = ddlTitle.SelectedItem.Text.Trim();
cmd.Parameters.Add("@FamilyName", SqlDbType.VarChar).Value = txtFamilyName.Text.Trim();
cmd.Parameters.Add("@FirstName", SqlDbType.VarChar).Value = txtFirstName.Text.Trim();
cmd.Parameters.Add("@MiddleName1", SqlDbType.VarChar).Value = txtMiddleName1.Text.Trim();
cmd.Parameters.Add("@MiddleName2", SqlDbType.VarChar).Value = txtMiddleName2.Text.Trim();
cmd.Parameters.Add("@MiddleName3", SqlDbType.VarChar).Value = txtMiddleName3.Text.Trim();
cmd.Parameters.Add("@Gender", SqlDbType.VarChar).Value = ddlGender.SelectedItem.Text.Trim();
cmd.Parameters.Add("@DOB", SqlDbType.VarChar).Value = txtDOB.Text.Trim();
cmd.Parameters.Add("@CountryName", SqlDbType.VarChar).Value = ddlCountry.SelectedItem.Text.Trim();
cmd.Parameters.Add("@StateName", SqlDbType.VarChar).Value = ddlState.SelectedItem.Text.Trim();
cmd.Parameters.Add("@CityName", SqlDbType.VarChar).Value = ddlCity.SelectedItem.Text.Trim();
cmd.Parameters.Add("@Verification", SqlDbType.VarChar).Value = txtVerification.Text.Trim();
cmd.Parameters.Add("@DateCreated", SqlDbType.DateTime).Value = DateTime.Now;
cmd.Connection = con;
try
{
con.Open();
cmd.ExecuteNonQuery();
Response.Redirect("Details.aspx");
}
catch (Exception ex)
{
throw ex;
}
finally
{
con.Close();
con.Dispose();
}
My .aspx code is:
<body>
<form id="form1" runat="server">
<div style="font-family:Gabriola">
<fieldset style="width:380px">
<legend><h3>Individual Builder: Stage 1</h3></legend>
<tr>
<td>
Type:
</td>
<td>
<asp:DropDownList ID="ddlType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlType_SelectedIndexChanged" DataTextField="TypeName" DataValueField="TypeID"></asp:DropDownList>
<br />
</td>
</tr>
<tr>
<td>
Rank:
</td>
<td>
<asp:DropDownList ID="ddlRank" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlRank_SelectedIndexChanged" DataTextField="RankName" DataValueField="RankID"></asp:DropDownList>
</td>
</tr>
<tr>
<td>
<br />
Title:
</td>
<td>
<asp:DropDownList ID="ddlTitle" AutoPostBack="true" runat="server" DataTextField="TitleName" DataValueField="TitleID"></asp:DropDownList>
</td>
</tr>
______________________________________________________________________________________________________________________________________________
<br />
<tr>
<td>
Family Name:
</td>
<td>
<asp:TextBox ID="txtFamilyName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<br />
First Name:
</td>
<td>
<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Middle Name:
</td>
<td>
<asp:TextBox ID="txtMiddleName1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Middle Name:
</td>
<td>
<asp:TextBox ID="txtMiddleName2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Middle Name:
</td>
<td>
<asp:TextBox ID="txtMiddleName3" runat="server"></asp:TextBox>
</td>
</tr>
<br />
______________________________________________________________________________________________________________________________________________
<br />
<tr>
<td>
Gender:
</td>
<td>
<asp:DropDownList ID="ddlGender" runat="server">
<asp:ListItem Value="0">Male</asp:ListItem>
<asp:ListItem Value="1">Female</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<br />
Date of Birth:
</td>
<td>
<asp:TextBox ID="txtDOB" runat="server"></asp:TextBox>
</td>
</tr>
<br />
______________________________________________________________________________________________________________________________________________
<tr>
<td>
Country of Birth:
</td>
<td>
<asp:DropDownList ID="ddlCountry" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged" style="height: 22px" DataTextField="CountryName" DataValueField="CountryID"></asp:DropDownList>
</td>
</tr>
<tr>
<td>
<br />
Province or State of Birth:
</td>
<td>
<asp:DropDownList ID="ddlState" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlState_SelectedIndexChanged" DataTextField="StateName" DataValueField="StateID"></asp:DropDownList>
<br />
</td>
</tr>
<tr>
<td>
City of Birth:
</td>
<td>
<asp:DropDownList ID="ddlCity" runat="server" AutoPostBack="true" DataTextField="CityName" DataValueField="CityID"></asp:DropDownList>
</td>
</tr>
<br />
______________________________________________________________________________________________________________________________________________
<tr>
<td>
Source:
</td>
<td>
<asp:TextBox ID="txtVerification" runat="server"></asp:TextBox>
</td>
</tr>
<br />
______________________________________________________________________________________________________________________________________________
<tr>
<td>
<asp:Button ID="btnClear" runat="server" Text="Clear" />
</td>
<td>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click"/>
</td>
</tr>
</fieldset>
</div>
</form>
</body>
Can anyone help me? I am sure it is something minor.
Thanks, I look forward to hearing from you.
|
|
|
|
|
Member 9142936 wrote: var id = new SqlParameter("IndividualID", System.Data.SqlDbType.Int);
id.Direction = System.Data.ParameterDirection.Output;
cmd.Parameters.Add(id);
cmd.Parameters.Add("@IndividualID", SqlDbType.Int);
You've added the @IndividualID parameter twice.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
don't know if this is due to poor db design or not but I have been struggling since last night to update some records from by selecting the values of records to be updated from a dynamically populated dropdownlist from a lookup table.
Essentially, we have three tables called Courses, Instructors and CourseInstructor tables.
CourseInstructor table is a bridge table between Courses and Instructor tables.
So, when adding courses and instructors to their various tables, their foreign keys are automatically added to the bridge table.
This seems to work fine so far.
However, users are having difficulties making changes to these tables.
For instance, if a user wishes to replace one instructor with another, she has not been to do so for far. After an update, the message indicates successful update the instructor names don't change.
Any ideas what I could have done wrong with the code below?
<asp:TemplateField HeaderText="Instructor">
<EditItemTemplate>
<asp:DropDownList ID="ddlInstructors" runat="server" AppendDataBoundItems="True" DataSourceID="SubjectDataSource"
DataTextField="InstructorName" DataValueField="InstructorId">
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblInstructors" runat="server" Text='<% #Bind("InstructorName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:SqlDataSource ID="sqlDataSourceloc" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConn %>"
SelectCommand="SELECT locationId, Location FROM Locations order by location asc"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
UpdateCommand = "Update tblCourseInstructor Set CourseId = @CourseId where (CourseId =@CourseId) Update tblCourseInstructor set InstructorId=@InstructorId where (instructorId=@instructorId and courseId = @courseId)"
SelectCommand="select l.locationid,c.CourseId, i.instructorId,CourseName, i.instructorname, dbo.fnFormatDate(t.trainingDates, 'MON/DD/YYYY') trainingDates, t.trainingTime,CourseDescription from Courses c, tblLocations l, TrainingDates t, Instructors i, CourseInstructor ci where l.locationid = c.locationid and c.dateId = t.dateId and i.instructorid = ci.instructorId and c.courseid=ci.courseid and YEAR(t.trainingDates) = YEAR(getDate())"
FilterExpression="LocationId = '{0}'" >
<FilterParameters>
<asp:ControlParameter ControlID="ddlLocation" Name="LocationId" PropertyName="SelectedValue" Type="Int32" />
</FilterParameters>
<UpdateParameters>
<asp:Parameter Name="CourseId" Type="Int32" />
<asp:Parameter Name="instructorId" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SubjectDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:DBConn %>"
SelectCommand="SELECT instructorId, InstructorName FROM dbo.Instructors order by InstructorName">
</asp:SqlDataSource>
Then I tried updating it from codebehind with code below
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles GridView1.RowUpdating
Dim ddAssigned As DropDownList = DirectCast(GridView1.Rows(e.RowIndex).FindControl("ddlInstructors"), DropDownList)
e.NewValues("instructorId") = ddAssigned.SelectedValue
SubjectDataSource.DataBind()
End Sub
but got the following error:
'SqlDataSource1' unless UpdateCommand is specified.
Any ideas how do I fixt this one?
|
|
|
|
|
I'm taking a big guess here on this, but I think this is your problem.
I wanna say that it's a bad design, but I haven't seen the design, but the CourseID should say the same if your just updating the teacher
UpdateCommand = _
"Update tblCourseInstructor Set CourseId = @CourseId where (CourseId =@CourseId) " & _
"Update tblCourseInstructor set InstructorId=@InstructorId where (instructorId=@instructorId and courseId = @courseId)"
<pre>
UpdateCommand = _
"Update tblCourseInstructor set InstructorId=@InstructorId where courseId = @courseId)"
</pre>
|
|
|
|
|
Hi,
Thanks for your time responding to my question.
My design idea was based on the fact that this is a many to many relationship between teacher and course.
A teacher can teach more than one courses just as a course can be thought by more than one teacher.
This made it many to many. So, there is one way I know to bridge them and that's by creating a third table that has foreign key for both tables.
How would you have designed them?
|
|
|
|
|
I think you have it backwards, and should try flipping them around.
Set the teacher id, then set the course id
If you change the course id first, then the teacher id will not change because you changed the course id, and your using the same parameter @courseid which is static or the same value.
As far as design goes, I'd have to see the map, or see the whole picture to tell. Jorgen is really good at that, you would have to prepare a well worded question in database forum for that.
I think it's a SQL or database issue here.
|
|
|
|
|
Just my opinion, I'm not the best at this.
I think a course is a course, like a shoe being sold online.
You can have the same course, like shoe sizes,
The teacher is just a category, or a shoe size, and the time and day of the course is like the color of a shoe.
So take a course marketing 101,
marketing101-time-teacher
1 table
1 record marketing 101 with time and teacher id
Join 1 more table time represented by time id
Join 1 more table teacher represented by teacher id
Then just update the marketing 101 with the correct time and teacher.
|
|
|
|
|
I want to insert some JavaScript code for validation. Here it is :
script language="javascript">
function checkEmail() {
var email = document.getElementById('txtEmail');
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(email.value)) {
alert('Please provide a valid email address');
email.focus;
return false;
}
}</script>
and the code in body is :
<input type='text' id='txtEmail'/>
<input type='submit' name='submit' onclick='Javascript:checkEmail();'/>
Now I want to check for validation on submit button but I also want to run code written in .cs page for
<asp:Button ID="BtnSubmit" runat="server" onclick="Button1_Click" Text="Register Now" />
|
|
|
|
|
Hi,
Something like this should do it:
<asp:Button ID="BtnSubmit" runat="server" onClientClick="return checkEmail();" onClick="Button1_Click" Text="Register Now" />
If your checkEmail routine returns true, then a post back occurs - which will run the serverside code in Button1_Click.
If the validation fails, then no postback will occur.
Hope it helps.
|
|
|
|
|
Dear readers,
Could anyone provide me an example how I can call multiple OData services from within a .net API asynchronously? I’m using DataServiceQuery’s to get all the data from the external OData services. I have tried using:
public static class QueryExtension
{
public static Task<IEnumerable<TResult>>; QueryAsync<TResult>(this DataServiceQuery<TResult> query)
{
return Task<IEnumerable<TResult>>.Factory.FromAsync(query.BeginExecute, query.EndExecute, null);
}
}
But my webapi gets locked that way.
Best regards,
Rémy
|
|
|
|
|
|
Hi i am new to dot net i have a question that how does an aspx page executes without an error even after removing page load method.
Thanks in advance.
|
|
|
|
|
Because of the framework - your page inherits from the common page that has a default Load event handler...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
|
Am working in 3 tier architecture in asp.net.i wanted to learn mvc and which version i will start first (mvc 1,2,3,etc).which is the best way to study mvc in asp.net. 
|
|
|
|
|
Video tutorials are the best.
If you can spend few dollars then go with Pluralsight. The best way of learning, as per my experience
http://www.pluralsight.com/training/Courses#aspdotnet
There ASP.Net MVC official site is also very good. Step by step Walk through step.
http://www.asp.net/mvc/tutorials/mvc-5/introduction/getting-started
Search in Code project articles. There are plenty of articles. Follow these tutorials and try to build an application from the ground, is the best way to learn.
I am currently working with MVC 4. I recommend you to start with MVC 5 which is almost an year old.
Good luck.
|
|
|
|
|
Thank u Mr Swinkaran 
|
|
|
|
|
|
Hi folks, can someone please help, I have been going round in circles with this and I’m new to ASP & C#.
Could someone please create a basic example of how to display a web user controls i.e. dropdown lists on one page and the results displaced on a second page within a Gridview.
I have store proc for the GridView, big thanks as I am losing the plot here!!!
USE [TyreSannerSQL]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[SearchResults] @Width int, @Profile int, @Diamete int, @Speed nvarchar, @CustPostcode nvarchar (50)
As
Begin
SELECT Suppliers.SupplierID, Suppliers.SupplierName, Product.Width, Product.Profile, Product.Diamete, Product.Speed, Product.Brand, Product.TyreModel, Product.TyreType,
Product.RollingResistance, Product.WetGrip, Product.NoiseEmission, Product.ProductUnitSalePrice
FROM Product INNER JOIN
Suppliers ON Product.SupplierFK = Suppliers.SupplierID
WHERE Width = @Width
and Product.Profile = @Profile
and Product.Diamete = @Diamete
and (Product.Speed = @Speed
or COALESCE(@Speed,'') = '')
and Suppliers.SupplierDistrict = LEFT(@CustPostcode,2)
ORDER BY Product.ProductUnitSalePrice ASC
End
|
|
|
|
|
When the dropdown changes you can use Response.Redirect("") to go to the page with the grid and pass the parameters through the query string.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|