Devendra Dighe

Devendra Dighe

  • NA
  • 78
  • 5.6k

how to save marathi data in sql server 2005

Apr 23 2014 4:38 AM
Hi, I am developing a website in marathi . I want save data in marathi in database .i am unable to save it. I tried the solutions given online but was unable to save it.
I used nvarchar(max) datatype and prefixed the values by N while inserting but it inserts values @name,@address....
my code is as follows
??? :
<asp:TextBox ID="txtName" runat="server" CssClass="validate[required]" Font-Names="Shivaji05" Font-Size="Medium" Height="23px" Width="132px">
 ???????? ???<asp:TextBox ID="txtMiddleName" runat="server" CssClass="validate[required]" Font-Names="Shivaji05" Height="23px" Width="132px">
 ?????<asp:TextBox ID="txtSurname" runat="server" CssClass="validate[required]" Font-Names="Shivaji05" Height="23px" Width="132px">
????

<asp:RadioButtonList ID="rdGender" runat="server" Height="51px" Width="106px" Font-Names="Shivaji05">
<asp:ListItem Value="M">?????
<asp:ListItem Value="F">??????

 ???? ??????<asp:TextBox ID="txtDOB" runat="server" TextMode="Date" CssClass="validate[required]" Font-Names="Rod" Height="23px" Width="132px"> ???? ?????<asp:TextBox ID="txtbrtplace" runat="server" CssClass="validate[required]" Font-Names="Shivaji05" Height="23px" Width="132px">
???? ???<asp:TextBox ID="txtbrtTime" runat="server" CssClass="validate[required]" Height="23px" Width="132px"> ????<asp:DropDownList ID="ddHeight" runat="server" CssClass="validate[required]">
<asp:ListItem>
<asp:ListItem>Below 4ft
<asp:ListItem>4ft 6in
<asp:ListItem>4ft 7in
<asp:ListItem>4ft 8in
<asp:ListItem>4ft 9in
<asp:ListItem>4ft 10in
<asp:ListItem>4ft 11in
<asp:ListItem>5ft
<asp:ListItem>5ft 1in
<asp:ListItem>5ft 2in
<asp:ListItem>5ft 3in
<asp:ListItem>5ft 4in
<asp:ListItem>5ft 5in
<asp:ListItem>5ft 6in
<asp:ListItem>5ft 7in
<asp:ListItem>5ft 8in
<asp:ListItem>5ft 9in
<asp:ListItem>5ft 10in
<asp:ListItem>5ft 11in
<asp:ListItem>6ft
<asp:ListItem>6ft 1in
<asp:ListItem>6ft 2in
<asp:ListItem>6ft 3in
<asp:ListItem>6ft 4in
<asp:ListItem>6ft 5in
<asp:ListItem>6ft 6in
<asp:ListItem>6ft 7in
<asp:ListItem>6ft 8in
<asp:ListItem>6ft 9in
<asp:ListItem>6ft 10in
<asp:ListItem>6ft 11in
<asp:ListItem>7ft
<asp:ListItem>Above 7ft

 ???<asp:DropDownList ID="ddWeight" runat="server" CssClass="validate[required]">
<asp:ListItem>
<asp:ListItem>41kg
<asp:ListItem>42kg
<asp:ListItem>43kg
<asp:ListItem>44kg
<asp:ListItem>45kg
<asp:ListItem>46kg
<asp:ListItem>47kg
<asp:ListItem>48kg
<asp:ListItem>49kg
<asp:ListItem>50kg
<asp:ListItem>51kg
<asp:ListItem>52kg
<asp:ListItem>53kg
<asp:ListItem>54kg
<asp:ListItem>55kg
<asp:ListItem>56kg
<asp:ListItem>57kg
<asp:ListItem>58kg
<asp:ListItem>59kg
<asp:ListItem>60kg
<asp:ListItem>61kg
<asp:ListItem>62kg
<asp:ListItem>63kg
<asp:ListItem>64kg
<asp:ListItem>65kg
<asp:ListItem>66kg
<asp:ListItem>67kg
<asp:ListItem>68kg
<asp:ListItem>69kg
<asp:ListItem>70kg
<asp:ListItem>71kg
<asp:ListItem>72kg
<asp:ListItem>73kg
<asp:ListItem>74kg
<asp:ListItem>75kg
<asp:ListItem>76kg
<asp:ListItem>77kg
<asp:ListItem>78kg
<asp:ListItem>79kg
<asp:ListItem>80kg
<asp:ListItem>81kg
<asp:ListItem>82kg
<asp:ListItem>83kg
<asp:ListItem>84kg
<asp:ListItem>85kg
<asp:ListItem>86kg
<asp:ListItem>87kg
<asp:ListItem>88kg
<asp:ListItem>89kg
<asp:ListItem>90kg
<asp:ListItem>91kg
<asp:ListItem>92kg
<asp:ListItem>93kg
<asp:ListItem>94kg
<asp:ListItem>95kg
<asp:ListItem>96kg
<asp:ListItem>97kg
<asp:ListItem>98kg
<asp:ListItem>99kg
<asp:ListItem>100kg
<asp:ListItem>101kg
<asp:ListItem>102kg
<asp:ListItem>103kg
<asp:ListItem>104kg
<asp:ListItem>105kg
<asp:ListItem>106kg
<asp:ListItem>107kg
<asp:ListItem>108kg
<asp:ListItem>109kg
<asp:ListItem>110kg
<asp:ListItem>111kg
<asp:ListItem>112kg
<asp:ListItem>113kg
<asp:ListItem>114kg
<asp:ListItem>115kg
<asp:ListItem>116kg
<asp:ListItem>117kg
<asp:ListItem>118kg
<asp:ListItem>119kg
<asp:ListItem>120kg
<asp:ListItem>121kg
<asp:ListItem>122kg
<asp:ListItem>123kg
<asp:ListItem>124kg
<asp:ListItem>125kg
<asp:ListItem>126kg
<asp:ListItem>127kg
<asp:ListItem>128kg
<asp:ListItem>129kg
<asp:ListItem>130kg
<asp:ListItem>131kg
<asp:ListItem>132kg
<asp:ListItem>133kg
<asp:ListItem>134kg
<asp:ListItem>135kg
<asp:ListItem>136kg
<asp:ListItem>137kg
<asp:ListItem>138kg
<asp:ListItem>139kg
<asp:ListItem>140kg
<asp:ListItem>141kg
<asp:ListItem>142kg
<asp:ListItem>143kg
<asp:ListItem>144kg
<asp:ListItem>145kg
<asp:ListItem>146kg
<asp:ListItem>147kg
<asp:ListItem>148kg
<asp:ListItem>149kg
<asp:ListItem>150kg
??????<asp:DropDownList ID="ddBloodgrp" runat="server" CssClass="validate[required]">
<asp:ListItem>
<asp:ListItem>A+
<asp:ListItem>A-
<asp:ListItem>AB+
<asp:ListItem>AB-
<asp:ListItem>B+
<asp:ListItem>B-
<asp:ListItem>O+
<asp:ListItem>O-
 ??????? ?????<asp:RadioButtonList ID="rdph" runat="server" >
<asp:ListItem>???
<asp:ListItem>????

 ??????? ??????<asp:DropDownList ID="ddMaritalStatus" runat="server" CssClass="validate[required]">
<asp:ListItem>
<asp:ListItem>????????
<asp:ListItem>?????????
<asp:ListItem>?????
??????<asp:TextBox ID="txtEducation" runat="server" CssClass="validate[required]" Font-Names="Shivaji05" Height="23px" Width="132px"> ??????? / ?????<asp:TextBox ID="txtJob" runat="server" CssClass="validate[required]" Font-Names="Shivaji05" Height="23px" Width="132px"> ???????<asp:TextBox ID="txtIncome" runat="server" CssClass="validate[required]" Font-Names="Shivaji05" Height="23px" Width="132px">
??<asp:TextBox ID="txtAge" runat="server" CssClass="validate[required]">

???????? ??????.

???????? ???<asp:TextBox ID="txtFathersName" runat="server" CssClass="validate[required]" Font-Names="Shivaji05" Height="23px" Width="132px"> ???? ???<asp:TextBox ID="txtMothersName" runat="server" CssClass="validate[required]" Font-Names="Shivaji05" Height="23px" Width="132px"> ???????? ???????/?????<asp:TextBox ID="txtFatherjob" runat="server" CssClass="validate[required]" Font-Names="Shivaji05" Height="23px" Width="132px">
???<asp:TextBox ID="txtNobrother" runat="server" CssClass="validate[required]" Height="23px" Width="132px"> ????<asp:TextBox ID="txtNoSister" runat="server" CssClass="validate[required]" Height="23px" Width="132px"> ??????? ???<asp:TextBox ID="txtMamaName" runat="server" CssClass="validate[required]" Font-Names="Shivaji05" Height="23px" Width="132px">
??????? ?????<asp:TextBox ID="txtMamaAddr" runat="server" CssClass="validate[required]" Font-Names="Shivaji05" Height="23px" Width="132px"> ??????? ???????<asp:TextBox ID="txtMamaJob" runat="server" CssClass="validate[required]" Font-Names="Shivaji05" Height="23px" Width="132px">



???<asp:DropDownList ID="ddras" runat="server" CssClass="validate[required]">
<asp:ListItem>
<asp:ListItem>???
<asp:ListItem>????
<asp:ListItem>?????
<asp:ListItem>????
<asp:ListItem>????
<asp:ListItem>?????
<asp:ListItem>???
<asp:ListItem>???????
<asp:ListItem>???
<asp:ListItem>???
<asp:ListItem>????
<asp:ListItem>???
 ??<asp:DropDownList ID="ddgan" runat="server" CssClass="validate[required]">
<asp:ListItem>
<asp:ListItem>???
<asp:ListItem>??????
<asp:ListItem>??????
 
????
<asp:RadioButtonList ID="rdMaglik" runat="server">
<asp:ListItem>???
<asp:ListItem>????

 ????<asp:TextBox ID="txtdevak" runat="server" Font-Names="Shivaji05" Height="23px" Width="132px"> ?????<asp:TextBox ID="txtgotra" runat="server" Font-Names="Shivaji05" Height="23px" Width="132px">

?????? ?????

?????<asp:TextBox ID="txtAddre" runat="server" CssClass="validate[required]" Height="105px" TextMode="MultiLine" Font-Names="Shivaji02" Width="160px"> ????<asp:TextBox ID="txtEmail" runat="server" CssClass="validate[required,custom[email]" Height="23px" Width="132px"> ?????? ???????<asp:TextBox ID="txtMobileNo" runat="server" CssClass="validate[required]" Height="23px" Width="132px">

User ID<asp:TextBox ID="txtuserid" runat="server" CssClass="validate[required]" Height="23px" Width="132px">

???? ?????


????<asp:FileUpload ID="FileUpload1" runat="server" CssClass="validate[required]"/>
<asp:Button ID="btnSubmit" runat="server" Text="?????" Width="112px" OnClick="btnSubmit_Click" /> <asp:Button ID="btnreset" runat="server" Text="?????" Width="112px" />

and c# code is :protected void btnSubmit_Click(object sender, EventArgs e)
{
paswd = this.getrandomno();
try
{

string Height = ddHeight.SelectedValue.ToString();
string weight = ddWeight.SelectedValue.ToString();
string ras = ddras.SelectedValue.ToString();
string gan = ddgan.SelectedValue.ToString();
string bloodgrp = ddBloodgrp.SelectedValue.ToString();
string maritalStatus = ddMaritalStatus.SelectedValue.ToString();
int len = FileUpload1.PostedFile.ContentLength;
byte[] pic = new byte[len];
HttpPostedFile img = FileUpload1.PostedFile;
FileUpload1.PostedFile.InputStream.Read(pic, 0, len);
SqlConnection con = new SqlConnection();
con.ConnectionString = ConfigurationManager.ConnectionStrings["MahatmaPhule"].ToString();
con.Open();
SqlCommand cmd = new SqlCommand("INSERT INTO userRegistration(firstName,middleName,lastName,gender,dob,birthplace,birthtime,height,weight,bloodgrp,physicalStatus,maritalstatus,education,occupation,income,fatherName,motherName,fatherOccupation,nofbrother,nofsister,mamaName,mamaAddress,mamaOccupation,ras,gan,manglik,devak,gothra,address,email,mobileNo,userId,photo) VALUES(N'@firstName',N'@middleName',N'@lastName',N'@gender',@dob,N'@birthplace',@birthtime,@height,@weight,@bloodgrp,N'@physicalStatus',N'@maritalstatus',N'@education',N'@occupation',@income,N'@fatherName',N'@motherName',N'@fatherOccupation',@nofbrother,@nofsister,N'@mamaName',N'@mamaAddress',N'@mamaOccupation',N'@ras',N'@gan',N'@manglik',N'@devak',N'@gothra',N'@address',@email,@mobileNo,@userId,@photo)", con);
cmd.Connection = con;

cmd.Parameters.AddWithValue("@firstName", txtName.Text);
cmd.Parameters.AddWithValue("@middleName", txtMiddleName.Text);
cmd.Parameters.AddWithValue("@lastName", txtSurname.Text);
cmd.Parameters.AddWithValue("@gender", rdGender.SelectedValue);
cmd.Parameters.AddWithValue("@dob", txtDOB.Text);
cmd.Parameters.AddWithValue("@birthplace", txtbrtplace.Text);
cmd.Parameters.AddWithValue("@birthtime", txtbrtTime.Text);
cmd.Parameters.AddWithValue("@height", Height);
cmd.Parameters.AddWithValue("@weight", weight);
cmd.Parameters.AddWithValue("@bloodgrp", bloodgrp);
cmd.Parameters.AddWithValue("@physicalStatus", rdph.SelectedValue);
cmd.Parameters.AddWithValue("@maritalstatus", maritalStatus);
cmd.Parameters.AddWithValue("@education", txtEducation.Text);
cmd.Parameters.AddWithValue("@occupation", txtJob.Text);
cmd.Parameters.AddWithValue("@income", txtIncome.Text);
cmd.Parameters.AddWithValue("@fatherName", txtFathersName.Text);
cmd.Parameters.AddWithValue("@motherName", txtMothersName.Text);
cmd.Parameters.AddWithValue("@fatherOccupation", txtFatherjob.Text);
cmd.Parameters.AddWithValue("@nofbrother", txtNobrother.Text);
cmd.Parameters.AddWithValue("@nofsister", txtNoSister.Text);
cmd.Parameters.AddWithValue("@mamaName", txtMamaName.Text);
cmd.Parameters.AddWithValue("@mamaAddress", txtMamaAddr.Text);
cmd.Parameters.AddWithValue("@mamaOccupation", txtMamaJob.Text);
cmd.Parameters.AddWithValue("@ras", ras);
cmd.Parameters.AddWithValue("@gan", gan);
cmd.Parameters.AddWithValue("@manglik", rdMaglik.SelectedValue);
cmd.Parameters.AddWithValue("@devak", txtdevak.Text);
cmd.Parameters.AddWithValue("@gothra", txtgotra.Text);
cmd.Parameters.AddWithValue("@address", txtAddre.Text);
cmd.Parameters.AddWithValue("@email", txtEmail.Text);
cmd.Parameters.AddWithValue("@mobileNo", txtMobileNo.Text);
cmd.Parameters.AddWithValue("@userId", txtuserid.Text);
cmd.Parameters.AddWithValue("@photo", pic);
int c = cmd.ExecuteNonQuery();
if (c > 0)
{
string strScript = "<script language='JavaScript'>alert('Records Inserted Successfully!')</script>";
Page.RegisterStartupScript("PopUp", strScript);
}
else
{
string strScript = "<script language='JavaScript'>alert('Records Not Inserted Successfully!')</script>";
Page.RegisterStartupScript("PopUp", strScript);
}

}
catch (Exception ex)
{
throw ex;
}

plz help me to solve this problem
its shows output as @firstName,@middleName....... 

Answers (3)